On 09/08/2011 02:38 p.m., MB Software Solutions, LLC wrote:
> On 8/9/2011 1:23 PM, John Weller wrote:
>> I think that is a much better idea!  You have more control and it is only
>> reading a line at a time so there will not be any memory issues (famous last
>> words :-) )
> The last time I wrote any LLFF code, it was in BASIC and/or PASCAL over
> 15 years ago!  lol
>
> Looks like I'll use FOPEN to get the handle and FREAD to read each line.
>    How do I determine the number of lines (without using ALINES)...would
> be it the number of bytes returned from FREAD divided by the record
> length?  Also, would I use FSEEK to increment along the file inside a
> loop like so?
>
> liRecLength = 550
> liHandle = fopen("myfile.txt")
> do while not feof(liHandle)
>     lcLine = fread(liHandle,liRecLength)
>     * now do whatever processing on the lcLine variable
> enddo
>
>
> Does that look about right?  tia!

You might also try :

create cursor MyCursor (fileContents m)
append blank
append memo fileContents from 'myfile.txt' overwrite

set memowidth to 8192 && if your file has lines bigger than 8192 chars 
you are screwed!
for LineNo = 1 to MemLines(filecontents)
     LineBeingProcessed = MLINE(fileContents, /LineNo)/
&& Process the line
endfor

If this last for loop is too slow check out _MLINE in your VFP help 
which is a much faster (less readable) method.

I always find it easier this way than with fread()




--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to