02-24-2012 06:16 PM
I "created" a program which writes some .dat files. I'm using the fopen and fclose instructions.
My problem is that all the .dat files are created but impossible to change the folder destination.
My question is, how I could create and save my files in another folder directory than the root of my program?
Do I change my coed and use wrilefile instruction instead of fopen?
My second question is, what is the best way to transfer these files to another computer? Ethernet port, RS232, USB?
I'm a little bit lost, could you help me please?
02-25-2012 12:13 AM
Your question is a little bit puzzling as the parameter file_name in fopen allows for absolute and relative path names. So you can use any valid path such as
fopen ( "\\Users\\Wolfgang\\Documents\\data.txt","w"). All you have to note are the double backslash characters. Does it not work for you?
02-25-2012 11:15 AM
thank you for your answer. Yes it works !!!! Now, I have another question. I'm using DirSelectPopup to save a new file path and using this method with my new files to save them in this new folder.
DirSelectPopup ("", "Select Directory", 1, 1, szFilePath);
But, when I see the value of the szFilePath, I don't have a double backslash characters... How I can to transform szFilePath to be compatible with fopen?
Should I have to read all characters of szFilePath and change a simple backslash to a double backslash?
02-26-2012 12:40 AM
You can use the file name obtained from DirSelectPopup as is, the file name is valid (of course).
Only if you want to enter some special escape sequence characters yourself, such as a carriage return or a backslash, you need to code it in a special way, e.g.
\r carriage return
You will find more about this C behavior in every book or course about this programming language, one, without preference, can be found here
02-26-2012 04:55 AM
I can only add that using MakePathname command can help in building up a pathname starting from the path returned from DirSelectPopup and your own file name: with this command you won't have to struggle about special characters while building the string.