Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Making a new file...
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ZeroPaladn




PostPosted: Tue Jan 16, 2007 1:24 pm   Post subject: Making a new file...

I'm stumped on how to do this, creating a new txt file without actually having to exit the program, open and save a blank txt file (its annoying and impractical). I know how to delete one using the Kill syntax (heh), so I was thinking that maybe there was something like a Create function or something.

thanks guys
Sponsor
Sponsor
Sponsor
sponsor
Silent Avenger




PostPosted: Tue Jan 16, 2007 1:49 pm   Post subject: Re: Making a new file...

I'm not sure what you're actually trying to do but couldn't you just open and save a new sequential file with nothing in it?
rdrake




PostPosted: Tue Jan 16, 2007 2:21 pm   Post subject: RE:Making a new file...

Most languages should have a New or Create function. If you wish to save this file, look up a form of the Flush function. It will allow you to write contents to the file and view the updated version without closing the file itself.
Monstrosity_




PostPosted: Tue Jan 16, 2007 5:19 pm   Post subject: Re: Making a new file...

ZeroPaladn @ Tue Jan 16, 2007 2:24 pm wrote:
I'm stumped on how to do this, creating a new txt file without actually having to exit the program, open and save a blank txt file (its annoying and impractical). I know how to delete one using the Kill syntax (heh), so I was thinking that maybe there was something like a Create function or something.

thanks guys

Open does that for you.

MSDN wrote:
If the file specified by pathname doesn't exist, it is created when a file is opened for Append, Binary, Output, or Random modes.
ZeroPaladn




PostPosted: Wed Jan 17, 2007 1:01 pm   Post subject: Re: Making a new file...

Silent Avenger wrote:

I'm not sure what you're actually trying to do but couldn't you just open and save a new sequential file with nothing in it?

That is exactly what I'm trying to avoid. Opening a whole new file and saving it blank. I want the program to do that for me.

rdrake wrote:

Most languages should have a New or Create function. If you wish to save this file, look up a form of the Flush function. It will allow you to write contents to the file and view the updated version without closing the file itself.

I found something like that, is this it?
VisualBASIC:
Open "H:\whatever\whatever.txt" for Output as #1

I think this allows me to delete the contents of a file and re-write it, as oppose to Append where you can only add to the contents of it.

Monstrosity_ wrote:

ZeroPaladn @ Tue Jan 16, 2007 2:24 pm wrote:
I'm stumped on how to do this, creating a new txt file without actually having to exit the program, open and save a blank txt file (its annoying and impractical). I know how to delete one using the Kill syntax (heh), so I was thinking that maybe there was something like a Create function or something.

thanks guys

Open does that for you.

I wish. Open only opens the file. It's the open type that specifies if a new file will be created. Like you said...
Monstrosity_ wrote:
MSDN wrote:
If the file specified by pathname doesn't exist, it is created when a file is opened for Append, Binary, Output, or Random modes.



In short, I figured it out. Thanks for the help again guys!
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: