I have a text file which looks like this :
Flooding refers to all water that overflows a node, whether it ponds or not.
--------------------------------------------------------------------------
Total Maximum
Maximum Time of Max Flood Ponded
Hours Rate Occurrence Volume Depth
Node Flooded CMS days hr:min 10^6 ltr Meters
--------------------------------------------------------------------------
1064 0.15 0.000 0 00 00 0.000 0.35
1065 0.25 0.078 0 00 09 0.049 0.41
1130 0.25 0.626 0 00 00 0.106 0.90
1155 0.24 0.098 0 00 07 0.073 0.61
1173 0.25 0.106 0 00 15 0.022 0.76
i want to copy the numerical columns (no text) such that the resulting file is like as such :
1064 0.15 0.000 0 00 00 0.000 0.35
1065 0.25 0.078 0 00 09 0.049 0.41
1130 0.25 0.626 0 00 00 0.106 0.90
1155 0.24 0.098 0 00 07 0.073 0.61
1173 0.25 0.106 0 00 15 0.022 0.76
Till now i have managed to do this code in C :
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void main()
{
FILE *fs,*ft;
int ch;
int c;
fs=fopen("node.txt","r");
if (fs=NULL)
{
puts("cannot open source file");
exit(0);
}
ft=fopen("new_node.txt","w");
do
{
ch=fgetc(fs);
if (ch==EOF)
break;
else
{
if (ch>0)
fputc(ch,ft);
}
ch++;
}
while(1);
fclose(fs);
fclose(ft);
return 0;
}
The problem is that nothing is coming out of it. Can anyone help in this regard and provide a working code.