[JAVA] File handling
how do you open / read / write to a file in java?
___________________
waveartists.com - design shop
devnet.waveartists.comDesign & Programming community
Current Projects: ChaosOps mod (HalfLife2)
Login |
[JAVA] File handling[JAVA] File handlingCurrently viewing this thread: 1 (0 members and 1 guests) [JAVA] File handling how do you open / read / write to a file in java? ___________________ waveartists.com - design shop Current Projects: ChaosOps mod (HalfLife2) ZwitterionStatus: Offline!
Not completely sure, but wouldn't it be somewhat the same as inputting it to a variable? I've been juggling C++ and java around for school, so not exactly sure of the syntax but something using an input operator '>'? inputStream? ___________________ waveartists.com - design shop Current Projects: ChaosOps mod (HalfLife2) The_One1Status: Offline!
I Know i know!! ok here is the code for writing to a file: FileOutputStream fileHandle; and then after you declare this you can use if you just put in the name of the file like I did, it will go to the directory where your .java file is! if you want to go to another directory, you put the full path in there, ex. ("C:\\file.txt") you need 2 slashes because java takes the \ as a special character so \\ would be considered 1 \! Reading from file: FileReader File1;//creates a file input object and then you use fileReader.readLine(); that takes input as a String, so you would have to use parseInt to go to Integer and so on! thanx ___________________ waveartists.com - design shop Current Projects: ChaosOps mod (HalfLife2) btw... does java have an explode function or something that lets me open a delimited string.. and line searching--- how do i do that? ___________________ waveartists.com - design shop Current Projects: ChaosOps mod (HalfLife2) btw... the code you supplied does only partually work... it creates a file but it does not fill the file with the output i issue ___________________ waveartists.com - design shop Current Projects: ChaosOps mod (HalfLife2) sorry... found it all out... youll have to issue the close method to execute the writing ___________________ waveartists.com - design shop Current Projects: ChaosOps mod (HalfLife2) |
Copyright ©1999-2008 Neverside. All rights reserved.
Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach
NeverAPI generated this page in 0.0073 seconds.