aspose file tools*
The moose likes Beginning Java and the fly likes need help!!! please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "need help!!! please" Watch "need help!!! please" New topic
Author

need help!!! please

Tina Guilder
Greenhorn

Joined: Aug 23, 2006
Posts: 9
I have 2 files, in which the 2nd file needs to be inserted above the first file... I am totally lost.. if you can help it would be wonderful!!! thank you


Tina
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Welcome to JavaRanch!

I'm afraid I'm totally lost too. Can you be more specific about what you're asking? What are these "files"? And what do you mean by "insert"?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Tina Guilder
Greenhorn

Joined: Aug 23, 2006
Posts: 9
they are both text files, and a result of running the program is that the contents of the 2 file will be inserted about the first line of the 1st file...


Tina
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Tina Guilder:
they are both text files, and a result of running the program is that the contents of the 2 file will be inserted about the first line of the 1st file...

Okay, so this sounds like an I/O problem. What do you have so far? Are you able to "read in" a file? Where exactly are you stuck?
Dianne Doss
Greenhorn

Joined: Aug 18, 2006
Posts: 17
Does the result need to be in file 1,...or do you just need a result file that has the content of file 1 appended to the end of the content of file 2?
Tina Guilder
Greenhorn

Joined: Aug 23, 2006
Posts: 9
I have made it so it creates file3.. I just cant get the information in the other files in there. do i have to do a sequencelist??? the 3rd file is successfully created, but no data
Tina Guilder
Greenhorn

Joined: Aug 23, 2006
Posts: 9
this is what i have so far




EDIT by mw: Added Code Tags to original poster's indentation.
[ August 23, 2006: Message edited by: marc weber ]
lajos kamocsay
Ranch Hand

Joined: Aug 12, 2006
Posts: 37
Your code is printing the strings "c:\\file2.txt" and "c:\\file1.txt" in file3...

If you want to copy the contents of those files, you need to open them , read them and write what you read in to file3.
Tina Guilder
Greenhorn

Joined: Aug 23, 2006
Posts: 9
is there a string that makes it so it will automatically put the contents into the file.. because the purpose of this is so you dont have to keep typing it.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Tina Guilder:
...the purpose of this is so you dont have to keep typing it.

I think lajos is suggesting that your program needs to "open them, read them, and write what you read..."

You already have File objects representing the two "input" files. But if you want to write their contents out to a third file, you first need to "read in" that content. Hint: You're already using a FileOutputStream to write out to the third file, so to read in the contents of the first two files, you could use a...
Tina Guilder
Greenhorn

Joined: Aug 23, 2006
Posts: 9
fileinputstream???
Jody Brown
Ranch Hand

Joined: Nov 09, 2005
Posts: 43
Originally posted by Tina Guilder:
fileinputstream???


That sounds like a winner to me. Or a FileInputStream to be precise.
[ August 23, 2006: Message edited by: Jody Brown ]
Tina Guilder
Greenhorn

Joined: Aug 23, 2006
Posts: 9
Thank you everyone for your help..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help!!! please