CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 1999
    Posts
    8

    writing to a file

    I was playing with VB and desided to figure out how to write to a file (so i could save the high scores on this game i made..). I used the write function but then when i looked at the file all the strings where enclosed in quotes. Could anyone tell me how to get it to write to a file and not print the quotes?

    Another thing that i was wondering is how to write to a line in the midle of a file (eg. line 5) w/o having to rewrite the entire thing?


  2. #2
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: writing to a file

    You can use Print #filenumber statement for writing the Text/Ascii info.

    As for replacing a section of the file, i think the only way is to read the full file into a buffer, modify portions of it and write back the full buffer in one go. Otherwise when ever you modify a particular line, info after that line would be erased.

    However, you could change the file format to INI type and replace select key data with WritePrivateProfileString etc.

    VB also supports Text file type databases. May be this also you can use, to change select records. I dont exactly know how to....

    RK

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

Featured