473,466 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Is this programme writing data to a actual text file ??

gautamz07
26 New Member
Expand|Select|Wrap|Line Numbers
  1. int i; 
  2. FileInputStream fin; 
  3. FileOutputStream fout; 
  4. try { 
  5.             // open input file 
  6.     try { 
  7.     fin = new FileInputStream(args[0]); 
  8.     } catch(FileNotFoundException e) { 
  9.  
  10.     System.out.println("Input File Not Found"); 
  11.     return; 
  12.     } 
  13.                     // open output file 
  14. try { 
  15.     fout = new FileOutputStream(args[1]); 
  16.     } catch(FileNotFoundException e) { 
  17.     System.out.println("Error Opening Output File"); 
  18.     return; 
  19.     } 
  20.     } catch(ArrayIndexOutOfBoundsException e) { 
  21.     System.out.println("Usage: CopyFile From To"); 
  22.     return; 
  23.                     // Copy File 
  24.     try { 
  25.     do { 
  26.     i = fin.read(); 
  27.     if(i != -1) fout.write(i); 
  28.     } while(i != -1); 
  29.     } catch(IOException e) { 
  30.     System.out.println("File Error"); 
  31.     } 
  32.         fin.close(); 
  33.         fout.close(); 
  34.     } 
  35. }
  36.  
  37.  
  38.  
  39.  
  40.  
Dec 24 '13 #1
1 1217
zmbd
5,501 Recognized Expert Moderator Expert
What are you asking here?
You should be able to open the text file and see for yourself.
Dec 24 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: RadhakrishnanR | last post by:
Hi, By using VB6.0, I want to export database table data into text file with a tab delimiter. My User interface has: • Drop down list box contain list of data base table name. • A path...
3
by: gujarsachin2001 | last post by:
Hi friends, I m just stuck with extracting excel file data into text file. So can any body please help me out. thx, Sachin.
3
by: mainul | last post by:
Hi guys i can write text file and also can read it. below are the codes. <?PHP //write to a file $body_content="This is my content"; // Store some text to enter inside the file...
2
by: =?Utf-8?B?Tmc=?= | last post by:
Hi. have someone can give me some idea how to start. the thing i want do is using web page export the sql data to text file then let user download. eg. the webpage has one button. when user...
1
by: gmulholland | last post by:
HI, I am wondering if anyone knows how to specify what character set will be used when creating and then writing to a text file. This app says "create myfile.txt, then does a print to file method...
6
by: Apollo1376 | last post by:
I am very new to C++. I need some help with loading/reading data from text file and write in an array. I have the following data. 12/31/2004 1213.55 1217.33 1211.65 1211.92 786900000 1211.92...
1
by: phasita | last post by:
I would like to separate data in text file. For example A 35 160 B 25 145 C 40 130 the first column is name of member,the second column is age and the last one is...
4
by: Chris | last post by:
I am using the FileSystemOBject for writing text with Unicode as in the example below. When I try to read data from the file with ReadLine, I get "?????????" instead of characters with unicode. ...
0
by: =?Utf-8?B?U3dhcG5pbA==?= | last post by:
hi, In One application i m using Hashtabe to read an xml. After reading xml i want to write that hashtable data into text file. Hashtable is nested (two hashtable). How to do that? How can i...
1
by: Fidzril | last post by:
I want to write a program using C to read a sets of data from text file. 5sets of data as shown below. 1st column is label and follow with its value from index1-25...(index : value). 1 1:0.736553...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.