Re: VFP9SP1 -- choking on ALINES ("not enough memory")

Author: MB Software Solutions, LLC

Posted: 2011-08-09 at 13:38:03

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!

--

Mike Babcock, MCP

MB Software Solutions, LLC

President, Chief Software Architect

http://mbsoftwaresolutions.com

http://fabmate.com

http://twitter.com/mbabcock16

_______________________________________________

Post Messages to: ProFox@leafe.com

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/4E41707B.7030701@mbsoftwaresolutions.com

** 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.

©2011 MB Software Solutions, LLC