Thread: Newbie File Read and Save problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    4

    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!!
    Last edited by simham_uk; 06-05-2002 at 04:05 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 03-19-2009, 10:56 AM
  2. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  3. Still can not write or read from save file
    By WackoWolf in forum C++ Programming
    Replies: 37
    Last Post: 11-14-2004, 07:28 PM
  4. Still can not write or read from save file
    By WackoWolf in forum C++ Programming
    Replies: 2
    Last Post: 11-14-2004, 01:21 AM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM