|
On Tue, 2 Apr 2002, Jim Langston wrote: > Easiest way, read a single character at a time into a buffer until you hit > an End of line character. Then you have a line. Create this in a > subroutine once and be done with it. The potential problem here is that there may not be an end of line character reached before your buffer is filled. In C this creates a buffer overflow and in RPG an array index error. A solution to this is to allocate memory for a dynamic array as needed. Then you just need to be careful that you set a limit of some kind on how much memory your program will allocate. Your file may be very large and not contain any end of line characters. You could end up eating all the memory on the system. James Rich james@eaerich.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.