Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within I/O and Streams
Search Coderanch
Advance search
Google search
Register / Login
Forums
Register
Login
Java
»
I/O and Streams
program reagarding reading and writing to a file in java
priyapapathi sivanandampapathi
,
Greenhorn
Apr 21, 2005 02:14:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
I want a sample program regarding reading and writing to a file in
java
Stefan Willi
,
Ranch Hand
Apr 21, 2005 02:34:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Hi!
You should
take a look at
Sun's Java Tutorial
.
Here is an example (from the link above) to copy a file:
import java.io.*; public class Copy { public static void main(String[] args) throws IOException { File inputFile = new File("farrago.txt"); File outputFile = new File("outagain.txt"); FileReader in = new FileReader(inputFile); FileWriter out = new FileWriter(outputFile); int c; while ((c = in.read()) != -1) out.write(c); in.close(); out.close(); } }
Stefan
Ilja Preuss
,
author
staff
Apr 21, 2005 11:11:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Moving to IO and Streams...
Post by:
autobot
The problems of the world fade way as you eat a piece of pie. This tiny ad has never known problems:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
This thread has been viewed 947 times.
Similar Threads
Read n Modify Text file
perl script sending signals to java
new file creation
importing jar to java class.......
Regarding Lock on file
More...
All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:58:02
.