Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using FGETS and file has hex 1A at end - how tell at feo
Message
From
29/07/1999 13:29:35
Kenneth Downs
Secure Data Software, Inc.
New York, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00247780
Message ID:
00247793
Views:
24
Brenda,

The following loop works for me:
lnLineLength = xxx
DO WHILE NOT FEOF(lnFileHandle)
  lcOneLine = FREAD(lnFileHandle,lnLinelength+2)
  IF LEN(lcOneLine) < lnLineLength
    EXIT DO
  ENDIF
 
  ...process here...

ENDDO
Because we handle a lot of these files, I wrote myself a little routine that finds out the line length based on the position of the first CHR(10), so that the loop is general purpose. Otherwise you can hardcode lnLinelength.

Hope this helps.


>Using fopen, fgets and fclose to read a file. Each record has a hex 0D, 0A at the end. The last record in the file has only a hex 1A. This is causing me trouble because the feof is not detecting eof and the fgets does not read the 0A. I end of with a blank string returned from the fgets. Any ideas how to recodnize the eof. I do not want the 1A.
>
>Brenda
Previous
Reply
Map
View

Click here to load this message in the networking platform