07-25-2005 01:26 AM
07-25-2005 03:20 AM
07-25-2005 03:45 AM
02-13-2007 11:28 AM
02-13-2007 11:38 AM
declare msg at a fixed length - just make sure it is long enough. ( char msg[256] or 128 or 100).
Also, the first param to openfile should be the file's name (and directory path if needed).
for example:
fH=openfile( "c:\Reports\Debug.txt", VAL_WRITE_ONLY,VAL_APPEND,VAL_ASCII);
You are not giving it a name at all in your statement. You have only dimension-ed an array when you define 'report'.
02-13-2007 11:49 AM
02-13-2007 11:55 AM
02-13-2007 11:59 AM
02-13-2007 02:36 PM - edited 02-13-2007 02:36 PM
Here is a way I have done it in the past. Note that this keeps 20 copies (you can change it to keep more) of a file names Debug_Out01.dat, Debug_Out02.dat through Debug_Out19.dat, and Debug_Out20.dat.
It creates these files in a directory called "Debug" within the directory from which it is run.
The "File* Debug_File" is defined globally. Anything else not defined locally to this routine was also defined globally.
A routine to return a pointer to the file was written so that multiple codes in multiple files could all call the same debug file.
Message Edited by scomack on 02-13-2007 02:38 PM
02-13-2007 04:00 PM
Hi nadster,
it's not clear to me what's your intention, but I can give you two suggestion: I hope one at least can help you a little...
If you want the user to be able to select its own file you can use FileSelectPopup, a function that opens standard "Open file..." dialogue box permitting the user to navigate up to the directory he wants and to select an existing file or type a new filename for the file to be created.
On the other hand, if you want to programmatically and progressively increase a file count you could rely on CreateAndOpenTemporaryFile, that permits you to input prefix and extension for a given file, automatically creating and opening a new file with the name "prefixNNN.ext" where NNN is a index for the file immediately available in the series. With this command you can automatically create up to 1000 files with a given prefix+extension pattern. The function automatically checks for duplicates and creates a surely unique filename (it returns -91 too many files on the 1001st filename).