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

    creating an empty text file...

    i basically just need a quick way to create an empty text file for output in a specified path... i thought that

    Open "c:\test.txt" for Output as #1



    would create one if the file didn't already exist, but i guess i was wrong...
    please let me know if you have any suggestions...

    thanks

    tom


  2. #2
    Join Date
    May 1999
    Posts
    9

    Re: creating an empty text file...

    open "text.txt" for output as #1
    close

    i had checked it created a empty text file named text.txt
    it worked for me it should do for u. becarefull if u already have opened a file of same number close it first.
    and check if u have file creation permission in specific folder if using Windows NT.
    if u re issue above command it will initilize the file. setting its size to 0 bytes.



  3. #3
    Join Date
    May 1999
    Posts
    2

    Re: creating an empty text file...

    If You use the Freefile function and a variable instead of the static #1, you are safer.

    Stian


  4. #4
    Join Date
    Jul 1999
    Posts
    3

    Re: creating an empty text file...

    this is how i do it and it always works

    Open App.Path & "\test.txt" For Binary As #1

    app.path is just a property of your program it gets the path that it is running from.




  5. #5
    Join Date
    Jun 1999
    Location
    Switzerland
    Posts
    58

    Re: creating an empty text file...

    An empty text file can be created simply in Notepad:
    you create a new file, leave it empty and save it as test.txt in the folder you want.
    Jan



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