×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    2

    How to read integer and float values from a file?

    I want to read "test.txt" wich store integer and float values.
    The dividers between values are spaces or tabs.
    for example...

    ....

    10 10.02 20.04 10.24

    ....

    Supose that I know the order of types in a file,,
    for example,
    3 integers followed by 2 float values, then 2 integers come.

    My goal is storing each integer to TInt and float value to TReal.

    I had used fopen(), fgets(), strtok(), atoi() and atof() in C/C++.
    but those functions are not supported by SDK for Symbian.

    Can anyone help me, please?

    Best regards,

    TS.

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142
    Hi

    You could use posix C-code in symbian as well. I haven't really have any use for it so don't know what you need to do to get it working, but search symbian discussions & this group and I'm sure the answer is there somewhere.

    In symbian way you could use RFile to read the file to buffer and then use TLex to get the values to TReal (float) and TInt (integer) variables.

    Or you could have a look into RFileWriteStream, which with you could read & write TReals and TInts strait to the file.

    yucca

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    128
    Some useful functions you can use:

    \Epoc32\include\libc\*.h

    Here has some functions such as : atoi, atol, and so on.


    Think this can help you a lot.

    Any questions more, Please let me know.

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •