English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

-0.000013828
-0.000014782
-0.000016689
-0.000018120
-0.000019550
.....
the numbers are placed as is in a text file...c:\\data.txt.....
I need to read them from file do some stuff and print the same number of numbers as shown above onto another text file...help please.

2007-02-08 07:51:42 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

2 answers

You'll need to open 2 files, one for writing and one for reading, use fopen() for this.

To read a line, use fgets().

You'll get these numbers as a string which is probably not what you want to "do some stuff". strtod() will convert them to doubles.

To write a line, use fprintf()

The compiler you're using or the internet will have complete documentation on these functions.

Hope this helps.....

2007-02-08 08:06:26 · answer #1 · answered by clueless_nerd 5 · 0 0

fgetc() seem into cin.getline(), cin.getchar(). those will show you how to to get a line till you hit a particular personality (often the n, yet you are able to specify which personality) and placed it right into a char variable. it is going to also grab white area. getchar()

2016-11-26 03:23:07 · answer #2 · answered by ? 3 · 0 0

fedest.com, questions and answers