Limitation in writing text files ?

Hi When I have tried to write a long text into a text file using f.Write() method I have got an error stating that ‘Stack fault in memory’ eg . F.write(array[1] + array[2] + array[3] + array[4]+ array[5]+ array[6] + array[7] + array + array[9] + array[10]); Each element of array may contain text of 250 characters. However it was working successfully when I have tried to do this in two steps. F.write(array[1] + array[2]+ array[3]+ array[4] + array[5]); F.write (array[6] + array[7]+ array +array[9]+array[10]); Is it seems to be any limitation of writing no of characters into a file at a time ? Regards Joseph

A simple and stupid (buth nonethless correct) answer to your question would be: the computer is not an endless machine. Therefore there are always limits. In fact, the stack used in any application is a reserved memory area of static size. Typically 8, 16, 32 or 64 KBytes. This stack is temporarily used to store/save local variables. Depending on the nesting level of procedures the same procedure-call could lead to a stack overflow or work fine. There is absolutely nothing you can do about it. ------- With best regards from Switzerland Marcus Fabian

Why do you need to write all the strings in one go?

Remember that you’re using NAVISION’S file.write function… and that file.write takes a parameter: a TEXT 250 variable… if you’re passing it a text (by adding different ones) longer than 250 chars… it will surely crash. You can “trick” it if you need sending to a text file texts longer than 250 chars by simply creating an OCX with a function that writes to the file the text you send to it (myocx.writetext( filename text 250, mytexttoadd text 250)) and another one that sends the end-of line char to the file (myocx.changeline (filename text 250)) (for example). With those functions you’ll be able of doing something like: myocx.writetext(filename, array[1] ); myocx.writetext(filename, array[2] ); … myocx.writetext(filename, array[n] ); myocx.changeline (filename); – Alfonso Pertierra Spain

Hi Using OCX for this purpose in a good idea. But currently I don’t have an this type of OCX for testing. Thanks

hi, just use TEXTMODE=FALSE, and don’t forget write line end (CR/LF) what’s all…

Hi How to send a line end character to file ?? Regards Edited by - joseph_mathew on 2001 May 08 13:42:40

make two variables: CF:Char and LF:Char assign them 10 and 13 (numbers, not a chars) then file.WRITE(CR), file.WRITE(LF)



hi, just use TEXTMODE=FALSE, and don’t forget write line end (CR/LF) what’s all…

If we use Textmode=False the textfiles will be written using some unreadble characters. Regards

yeah, i forgot one thing: in this case you must write char by char to file (using Char type variable), not whole string at once :slight_smile:

Or continue using the TEXTMODE(TRUE) and just do a SEEK(-2) for each line written, if you want to append to the same line. Guess i will post this in the FAQ. EOD. Soren Nielsen, moderator Integration/Developer NOLUG