01-18-2006 10:21 AM
01-18-2006 10:35 AM
Hi k1_ke,
The library functions DataStr() and TimeStr() can help you out:
char filename[MAX_FILENAME_LEN];
if (file_sel == 0){
file_sel = 1;
file_opened = 1;
Fmt (filename, "Data_%s_%s.log", DataStr(), TimeStr());
file_handle = OpenFile (filename, VAL_READ_WRITE, VAL_TRUNCATE,
VAL_BINARY);
}
01-18-2006 10:36 AM
01-18-2006 10:48 AM - edited 01-18-2006 10:48 AM
Message Edited by k1_ke on 01-18-2006 11:49 AM
01-18-2006 10:56 AM
Hello k1_ke
Pull down the Library menu in the menu bar and select 'Utility...'. In the 'Select Function Panel' window that pops up, select 'Time/Date...'. You should find the functions DateStr() and TimeStr() there.
Greetings,
Wim
01-18-2006 10:58 AM
01-18-2006 11:58 AM
Hi Wim,
Sorry to keep bothering you, yeah i found that typo just after i emailed you. After making the changes it still doesnt work...well it passes that line now. My program compiles with no errors...i start it and when it reaches the file to openfile it crashes n get the following error
NON-FATAL RUN-TIME ERROR
Library function error (return value == -1)
Invalid argument
Also when i read the help file for OpenFile it says CAUTION: The Windows SDK also contains a OpenFile function. If you include windows.h and do not include formatio.h, you will get compile errors if you call the OpenFile function. but i need formatio.h for other things.
Let me know what i should do
Thanks
k1_ke
01-18-2006 01:29 PM
Hello k1_ke,
If the function OpenFile returns the value -1, an error occurred (read the OpenFile help page).
If you want to know what goes wrong, use the following code:
int error_nr;
if(file_sel==0)
{ //if file not selected, saves to data.log by default.
file_sel=1;
file_opened=1;
Fmt (filename, "Data_%s_%s.log", DataStr(), TimeStr());
01-18-2006 01:29 PM
Hello k1_ke,
If the function OpenFile returns the value -1, an error occurred (read the OpenFile help page).
If you want to know what goes wrong, use the following code:
int error_nr;
if(file_sel==0)
{ //if file not selected, saves to data.log by default.
file_sel=1;
file_opened=1;
Fmt (filename, "Data_%s_%s.log", DataStr(), TimeStr());
01-18-2006 01:33 PM
Sorry, I accidentally pressed the Tab Key and then kept hitting the space bar, causing 100 messages to be posted... ![]()
I planned to write the following:
Hello k1_ke,
If the function OpenFile returns the value -1, an error occurred (read the OpenFile help page).
If you want to know what goes wrong, use the following code:
int error_nr;
if(file_sel==0)
{ //if file not selected, saves to data.log by default.
file_sel=1;
file_opened=1;
Fmt (filename, "Data_%s_%s.log", DataStr(), TimeStr());