Results 1 to 5 of 5

Thread: File Saving...

  1. #1
    Guest

    Question

    I have an application that is going to save it's own custom project files (just like Visual Basic saves it's own project files), and I don't know what's a good way to do this. I don't want to save the files in Binary mode.

    The project files will contain only Integers and Strings. No binary data.

    There will be approximately 100 parameters that will need to be saved to the project file.

    This is what I'm thinking of doing...

    Code:
    Dim IntroEnabled As Boolean
    Dim IntroDir As String
    'And many more variables...
    
    Open Filename For Output As #1
    
         If IntroEnabled = True Then
              BoolValue = 1
         Else
              BoolValue = 0
         End If
    
         Write #1, BoolValue
    
         Write #1, IntroDir
    
         'And so on....
    
    Close #1
    The problem is when it comes to opening the files. How do I make the program read the first line in the project file, return the value and store it in a new variable, and then go to the next line until the eof the is reached?

    Thank you,

    Simon Bingier

  2. #2
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    Hi there,

    Try opening the file in Random mode.

    Dim Parameters()
    filename = "C:\TEST\TEST.XXX"
    Open filename For Random As #1
    'To load the parameters into memory:
    Get #1, , Parameters
    'To save the parameters into the file:
    Put #1, , Parameters


    Does it help?

  3. #3
    Guest
    Random saving mode is not what I want. In random saving mode, all of the parameters would be saved in any order.

    I want the parameters to be saved one by one, just like most professional applications have it.

    For example, VB saves it's project files like this...

    Name="Project1"
    HelpContextID="0"
    CompatibleMode="0"
    MajorVer=1
    MinorVer=0
    RevisionVer=0
    AutoIncrementVer=0

    I want to do the same thing or something similar. So that each line would hold a specified parameter, just like the example above does.

    -Simon Bingier


  4. #4
    Guest
    I guess I'll settle with Random saving, I guess it won't be as easy for the user to change values manually, but it's the only way that I've seen so far to do this.

    Thx,

    Simon Bingier

  5. #5
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Code:
    Open MYFILE for Input As #1
    Do While Not EOF(1)
    Line Input #1, MyVar
    'You could store the updated MyVar in an array here.
    Loop
    Close
    This get's the file Line by Line.
    Or is that not what you want?
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width