PDA

View Full Version : C\C++ help needed URGENT!!!


kirti.1127
Oct30-09, 01:34 AM
I need help in C program
I have to write a c/C++ progam to read a particular column in a .txt file.
like
23.40 90.46 -129.8 -0.3
22.51 90.91 11.7 7.6
22.51 91.35 11.3 -0.0
22.06 90.46 29.1 7.8
22.06 90.91 -12.6 3.8
22.06 91.35 -49.2 -29.2
22.06 91.80 -28.7 30.6
In the abv file i have to read the third column and write in the seperate .txt file.

rootX
Oct30-09, 02:28 AM
One simple approach:
1) Open the file and read each line to a string
2) Use space delimiter to make an temporary array
3) Make new file and write the third value
...

Hepth
Oct30-09, 02:50 AM
its even easier if you know the number of columns. fscanf() works great for regular tabulated data.