Newbie File Read and Save problem
Hi All!
I hope you can help.
I'm trying to write a very basic C app with one dialog box. The window contains 2 multiline text/edit fields.
What I need is:
1. A function to (called on opening the app):
(a) if exisits, copy "sample.bat" to "sample.bat.bak" //create a backup of course
(b) read "sample.bat" into the text field (IDEDIT1) in dialog box for editing.
(c) delete "sample.bat"
(d) if not exists create new (empty) "sample.bat" for editing
(e) and then read the new "sample.bat" into the text field (IDEDIT1) in dialog box for editing.
2. A function for the SAVE button to:
(a) write/save edited text from IDEDIT1 to new "sample.bat"
Each of these functions would be called twice I presume, one for each file. The 2 (sample.bat, sample2.bat) files will be hard coded in the function call, and will always be in the same directory as the app itself.
As you can see its very basic. I have the structure in place using Lcc-W32 Wedit, but just cant get these functions figured out.
I have read all the posts on this board regarding file i/o but none seem to be doing what I want, and I'm concerned about the strange characters used in batch files.
I'm a 3 day C programmer, with most of my experience (which is minimal) in PHP...not having '$' in front of vars is really messing me up!!!
Anyhooo, I appreciate I'm asking a lot, but I dont know where to start really, and found I learnt PHP in the early days by copying good examples, so hopefully that will work hear too.
Thanks!!