Hi everyone
I have a routine that produces a text file for importing into an invoicing program, using fputs. I can create a new text file OK (fcreate), and have succeeded in writing to it, but I would like to re-open the file I created and add more lines to it at a later date. When I do this, I get a valid file handle returned but when I write lines to it using fputs, they don't get written. My code is:
&& Create the invoice file
fileHandle = fopen('invoice.csv') && Tried 12 & 2, no luck
if fileHandle = -1
&& File has been deleted, create a new one
fileHandle = fcreate('invoice.csv')
endif
&& Now some code that stores values from a table to a buffer
&& Put the new line in the text file
fputs(fileHandle,fileBuffer)
BTW, I don't want to use export as it is not appropriate for what I want to do. Any ideas anyone ??
Jim Worley
jim@aits-uk.net
15 years practical IT experience from sales to support to development plus B.Sc. (Hons) Computer Studies, fluent German speaker, willing to have a go at anything and don't suffer fools gladly !
I have a routine that produces a text file for importing into an invoicing program, using fputs. I can create a new text file OK (fcreate), and have succeeded in writing to it, but I would like to re-open the file I created and add more lines to it at a later date. When I do this, I get a valid file handle returned but when I write lines to it using fputs, they don't get written. My code is:
&& Create the invoice file
fileHandle = fopen('invoice.csv') && Tried 12 & 2, no luck
if fileHandle = -1
&& File has been deleted, create a new one
fileHandle = fcreate('invoice.csv')
endif
&& Now some code that stores values from a table to a buffer
&& Put the new line in the text file
fputs(fileHandle,fileBuffer)
BTW, I don't want to use export as it is not appropriate for what I want to do. Any ideas anyone ??
Jim Worley
jim@aits-uk.net
15 years practical IT experience from sales to support to development plus B.Sc. (Hons) Computer Studies, fluent German speaker, willing to have a go at anything and don't suffer fools gladly !