#include <stdio.h>
void stripnl(char *str) {
while(strlen(str) && ( (str[strlen(str) - 1] == 13) ||
( str[strlen(str) - 1] == 10 ))) {
str[strlen(str) - 1] = 0;
}
}
int main() {
FILE *infile;
char fname[40];
char line[100];
int lcount=1,i=0;
char mean[100];
/* Read in the filename */
printf("Enter the name of a ascii file: ");//input txt or cel file
fgets(fname, sizeof(fname), stdin);
/* We need to get rid of the newline char. */
stripnl(fname);
/* Open the file. If NULL is returned there was an error */
if((infile = fopen(fname, "r")) == NULL)
{
printf("Error Opening File.\n");
exit(1);
}
for(lcount=0;lcount<25;lcount++)
{
while( fgets(line, sizeof(line), infile) != NULL)
{
printf("%s", line);
}
}
fclose(infile); /* Close the file */
}
can anybody help me out how to extract a column from txt or cel file format.....thnxx in advance....