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

Username:   Password: 
 RegisterRegister   
 is there a way to find out ...
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Genisis




PostPosted: Thu Jun 15, 2006 8:01 am   Post subject: is there a way to find out ...

is there a way to find out if there isnt a file by a name and if there isnt create a file by that name and if there is read from it? for example

find the file Matts Numbers
if there isnt that file create the file Matts Numbers
if there is then Read that file
Sponsor
Sponsor
Sponsor
sponsor
HellblazerX




PostPosted: Thu Jun 15, 2006 10:05 am   Post subject: (No subject)

What's the point of making a new file, and then just reading from it? It's not going to contain anything, and if you do add something, you have to have stored the values into your program, so what's the point of reading data you already have?

And to answer your question, if you use BufferedWriter to write to a file, and the file is non existant, Java will automatically make the file for you.
Omnipotence




PostPosted: Sat Jun 17, 2006 10:44 am   Post subject: (No subject)

HellblazerX wrote:
What's the point of making a new file, and then just reading from it? It's not going to contain anything, and if you do add something, you have to have stored the values into your program, so what's the point of reading data you already have?


Well no, he never said anything about READING from the new file, it could be that he makes the new file so that he can save stuff in it, maybe something to do with user input and read it for when the program is run again
wtd




PostPosted: Sat Jun 17, 2006 11:23 am   Post subject: (No subject)

Dealing with files? Java's File class docs seem the likely place to look for info.

http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: