how to form an array of numbers , taken input from a file in C
Posted
by mekasperasky
on Stack Overflow
See other posts from Stack Overflow
or by mekasperasky
Published on 2010-05-27T15:58:30Z
Indexed on
2010/05/27
16:01 UTC
Read the original article
Hit count: 109
Filed under:
c
The program should be able to make an array of numbers from a text file which reads like this The data is given as this 123 2132 1100909 3213 89890
my code for it is
char a;
char d[100];
char array[100];
a=fgetc(fp) // where fp is a file pointer
if (a=='')
{
d[count1]='/0';
strcpy(&array[count],d);
count=count+1;
memset(d,'\0',100)
count1=0;
}
else
{
d[count1]=a;
count1=count1+1;
}
a=fgetc(fp);
© Stack Overflow or respective owner