burnerman
Member
I didn't have much time to check this today but I'd like to complete this job tomorrow morning.
Following a batch process I trigger a program that creates a string comprising several items of data with comma seperators in between.
In the same program I then want to write that string to the next line in a file and then send that file to a PC (overwriting the previous version of that file) using the FTP server.
So far I've got the generation of the string working fine as I have a test page where I can view the string created and view the value of the integer 'bytes_written' (I never saw a value other than zero). After that the program should write the string to the relevant file on the CF card (which is mounted OK) but it doesn't seem to be writing anything to the file.
My code is like this:
int cfile;
cfile=OpenFile(file_path,1);
bytes_written:=WriteFileLine(cfile,file_data);
CloseFile(cfile);
where 'file_path' is a string variable, say, "/logs/reports/machine1.csv" and 'file_data' is the string that I created.
Once I get this part working then I will put a further line in the program like this to send the file to the pc:
FtpPutFile(0,file_path,"c:/reports/machine1.csv",0);
Will this ovewrite a previous version of c:/reports/machine1.csv ?
My thoughts as to why it might not be writing to the CF card are:
A. at the time of testing I was connected to the G306 via USB - does this prevent any writing to the CF by the program because the PC is accessing the CF?
or
B. Delays (and/or proof of actions completed) are required between actions such as opening, writing to and closing the file (and subsequently sending the file to the pc).
Does anyone have any experience with this and point me in the right direction.
Thanks
Following a batch process I trigger a program that creates a string comprising several items of data with comma seperators in between.
In the same program I then want to write that string to the next line in a file and then send that file to a PC (overwriting the previous version of that file) using the FTP server.
So far I've got the generation of the string working fine as I have a test page where I can view the string created and view the value of the integer 'bytes_written' (I never saw a value other than zero). After that the program should write the string to the relevant file on the CF card (which is mounted OK) but it doesn't seem to be writing anything to the file.
My code is like this:
int cfile;
cfile=OpenFile(file_path,1);
bytes_written:=WriteFileLine(cfile,file_data);
CloseFile(cfile);
where 'file_path' is a string variable, say, "/logs/reports/machine1.csv" and 'file_data' is the string that I created.
Once I get this part working then I will put a further line in the program like this to send the file to the pc:
FtpPutFile(0,file_path,"c:/reports/machine1.csv",0);
Will this ovewrite a previous version of c:/reports/machine1.csv ?
My thoughts as to why it might not be writing to the CF card are:
A. at the time of testing I was connected to the G306 via USB - does this prevent any writing to the CF by the program because the PC is accessing the CF?
or
B. Delays (and/or proof of actions completed) are required between actions such as opening, writing to and closing the file (and subsequently sending the file to the pc).
Does anyone have any experience with this and point me in the right direction.
Thanks
Last edited: