Delphi

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Using the copy function to separate data

    2 answers - 1097 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    ALL,
    I have a telnet connection to a server computer that constant broadcast data to me each second. The data that I receive has spaces and tabs in the middle of the string. I receive the data I remove all spaces and tabs to get a single stream of data. After I receive the stream I attempt to parse the data into segments using the copy function.
    My problem is this when I look at the stream the data looks fine but when I use the copy funtion it does not work properly on the data.
    Here is an example :
    Single stream from a telnet connection
    0.0000.1370.000
    Data := ' 0.0000.1370.000'
    Copy (Data, 1, 3) yield value 0.0 which is fine.
    Copy (Data, 6, 8) yields value 0.0000.0 which is wrong.
    Copy (Data, 11, 13) yields value 0.0000.0000.0 which is wrong.
    I'm not sure why I am not receiving the correct data.
    r/Curtis
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com
    [Non-text portions of this message have been removed]
  • No.1 | | 839 bytes | |

    Curtis cloud wrote:
    Single stream from a telnet connection

    0.0000.1370.000

    Data := ' 0.0000.1370.000'

    Copy (Data, 1, 3) yield value 0.0 which is fine.
    Copy (Data, 6, 8) yields value 0.0000.0 which is wrong.
    Copy (Data, 11, 13) yields value 0.0000.0000.0 which is wrong.

    I'm not sure why I am not receiving the correct data.

    Given those four lines of code, _none_ of the results are correct. The
    first call should return ' 0.', not '0.0' since there's still a space as
    the first character of Data.

    If you remove the space, then the returned strings should be '0.0',
    '0.1370', and '0.000', respectively.

    Please copy and paste real compilable code that demonstrates how Copy
    doesn't work properly.
  • No.2 | | 1646 bytes | |

    Chris

    Try GetDeviceCaps (Windows, not Delphi). I know it works on Printers but I have
    not tried it on a monitor. Here is sample code for a printer:

    try

    {BITSPIXEL determine the number of colours in the device}
    nColourBits := GetDeviceCaps(Printer.Handle,BITSPIXEL);
    Total_Colour_Shades := IntPowerInt(2,nColourBits);

    {PLANES determine the number of colour planes}
    nPlanes := GetDeviceCaps(Printer.Handle,PLANES);
    Total_Colours := IntPowerInt(Total_Colour_Shades,nPlanes);

    {If the number of colours < 3 then it is a black and white printer}
    // You need to determine whether 3 is the correct changeover number
    bColour := Total_Colours 3;

    except on EIFlow do
    bColour := true;
    end;

    Good luck and a Happy New Year,

    Bobby Clarke

    Chris Lab wrote:

    Hello to all of you,

    I have this problem, we have many TImages (clear nice 24 bits pictures)
    components on a Form, but some of our clients have erros when they open
    the FRM cause they dont have a graphic card powerful enough to display
    all the colors.

    Can anybody help me

    1. at the FRMCREATE event, get the user max number of colors of his system
    2. Can you suggest a way to adapt the TImage so the colors would be
    reduced to that max number of colors and it would work for everyone.

    Thanks a lot.

    Christian

    [Non-text portions of this message have been removed]

    No virus found in this incoming message.
    Checked by AVG Free Edition.
    Version: 7.5.432 / Virus Database: 268.16.4/615 - Release Date: 03/01/2007 13:34

Re: Using the copy function to separate data


max 4000 letters.
Your nickname that display:
In order to stop the spam: 5 + 4 =
QUESTION ON "Delphi"

EMSDN.COM