Help - Simple input/output 
Author Message
 Help - Simple input/output

Subject: Help - Simple input/output
Newsgroups: comp.os.msdos.programmer.turbovision
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
Summary:
Keywords:

Hi, C experts:

I am quite new to C programming.  I have a simple quenstion, hope you
can give me some help.

I have a input file which has a format like this:

XY100.00 1 101.00 2 102.00 3
XY103.00 4 104.00 5
XY105.00 6 106.00 7 108.00 8 109.00 9

.....

I try to read this file and write to an output file like this:

XY100 1 101 2 102 3 103 4 104 5 105 6 106 7 .....

Any help would be very appreciated.  Please email me the answer.
Thanks,




Thu, 05 Mar 1998 03:00:00 GMT  
 Help - Simple input/output
: Hi, C experts:

: I have a input file which has a format like this:
: XY100.00 1 101.00 2 102.00 3
: XY103.00 4 104.00 5
: XY105.00 6 106.00 7 108.00 8 109.00 9
: I try to read this file and write to an output file like this:
: XY100 1 101 2 102 3 103 4 104 5 105 6 106 7 .....

I would program it this way:
Read the lines with fgets() in a buffer and use strtok() with a blank as token
to break up the words. then use sscanf() to translate the words into ints and
floats, bzw. to read this first "XYxxx.xx".

                        Christian

--
-------------------------------------------------------------------------------
I Christian Wolf                    I  Duernbachgasse 2                       I
I Hewlett Packard India PVT. LTD.   I  A-3252 Petzenkirchen                   I
I 29, Cunningham Road               I  AUSTRIA/EUROPE                         I
I Bangalore - 560 052               I  +43-7416-54774 (Phone & Fax)           I
I India                             I                                         I

--------------------------------------------------------------------------------



Sat, 07 Mar 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help - Simple input/output

2. input, output, input/output parameters?????

3. A simple example of input/output to a file

4. A simple example of input/output to a file

5. input/output filename, help!!!!!

6. Help needed with keyboard input and console output

7. Help! Object input and output

8. Help about simple painless input needed.

9. need pretty simple inputting help

10. Unable to sync input and output streams

11. function with array input/output

12. Hashing long input strings into short output strings

 

 
Powered by phpBB® Forum Software