Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I =fgets(lnHandle,9999) ?
Message
From
28/09/1998 21:32:20
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00141670
Message ID:
00141715
Views:
20
>>I want to read in a whole line at a time (to the charriage return) from a text file, but the lines are always longer than 256 characters and I don't know how long they are and they vary in length in the same file.
>>
>>How can I read a complete variable length line from a text file when the line is longer that 256 characters?
>>
>>TIA
>
>You do it exactly the way you stated in your topic:
>
>cDataVal = FGETS(nFileHandle,nBytes)
>
>From the FGETS help:
>nBytes Specifies the number of bytes FGETS( ) returns. FGETS( ) returns nBytes bytes unless a carriage return is encountered first. FGETS( ) returns data between the starting file-pointer position and the carriage return if a carriage return is encountered within nBytes bytes.
>
>If you omit nBytes, FGETS( ) returns a maximum of 254 bytes by default.
>
>
>A variable can be bigger than 254 long. A field in a table can not.
>
>So if you wanted to read upto 1000 bytes, you would:
>
>cDataVal = FGETS(nFH,1000)
>
>The variable cDataVal would contain the string up to the first CR or 1000 bytes, whichever comes first. Just keep looping through the file until done.

Alright, something's fishy here. Maybe you can tell me what went wrong.

I originally put in my routine "=fgets(lnHandle,999)" and it would crash. I kept changing the #. When the # was less that 256 it worked fine, but if I put in a # greater that 256 it crashed. Now I try it one more time to get the error message and it works fine.
Bill Morris
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform