aspose file tools*
The moose likes Java in General and the fly likes file io Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

file io

mike hengst
Ranch Hand

Joined: Oct 19, 2002
Posts: 43
I am having a problem figuring exactly what I need to do on this problem. I want to read in a file, place it in an array. After that it needs to be sent to a class that calculates the charge. The second part is supposed to output the results to another file(txt). I think I have the first part down. What I am wondering is how does one instantiate an object array, place the results into the appropiate array and then take that and print to a text file???Here is the code I have so far, any help will keep me from freakin' out...

[ December 14, 2002: Message edited by: mike hengst ]

Thank you Oh Lord<br />For the white blind light<br />A city rises from the sea<br />I had a splitting headache<br />from which the future's made<br />--morrisson
Viet Nguyen
Greenhorn

Joined: Dec 14, 2002
Posts: 1
I think you need a Printwriter in the try and catch block to print the results to the .txt files
for Example
{
try{
PrintWriter out = new PrintWriter(new FileWriter(outFile.txt));
All you codes goes here.
}catch(IOException e)
{
}
out.flush();
out.close();
System.out.println("finished");
}


Viet
mike hengst
Ranch Hand

Joined: Oct 19, 2002
Posts: 43
Thanks,Viet
I have been working on this all afternoon and I have changed my code to inlcude the PrintWriter stuff. i just don't think I am doing it right. Here is my ammended code. Maybe you or someone else can see what I am doing wrong, or not doing at all.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Continued here.


"I'm not back." - Bill Harding, Twister
 
jQuery in Action, 2nd edition
 
subject: file io