Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FGETS() AND FREAD()
Message
From
24/09/1998 12:00:34
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
24/09/1998 11:56:51
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00140397
Message ID:
00140419
Views:
23
>>Hello All,
>>I'm receiving oracle files where I don't know for sure what the carriage return is (whether it's a chr(13) or a chr(13) + chr(10).
>>
>>So, I open the file with an fopen(), I do a fgets() to find the length of a record, an fseek() to return to the top of the file and then an fread() with the length of a record * 2 which should bring down the carriage return for me to examine.
>>
>>The problem I am encountering is that the fgets() statement is only returning 254 bytes. When I examine the file in a file editor I can see that they are 1025 bytes in length!!
>>
>>If this is a DOS limitation, how can I overcome it and if not, what am I doing incorrectly??
>>
>>Thanks
>>
>>Sandy
>Sandy,
>Continue to use fgets() to return lines. It takes care of CRLF for you. Just add second parameter nLength (ie:65535) to define a larger length than default.
>Cetin
Too early pressed on send.
FPDOS fgets() defaults to 254 bytes.
handle=fopen("myfile.txt")
do while !feof(handle)
  cLine = fgets(handle,65535)
enddo
65535 is not wrong there. fgets() stops before if encounters CRLF.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform