Hello,
I've got problem with loop for and EOF in it. I want to write every thing from a file on screen it work with one line but i want to read all lines here is the code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main ()
{
int i,j,k,l,o,liczba,tab1[4];
FILE *f = fopen("b.txt", "r");
{
// for (o=1;EOF!=0;o++) problem here
{
for (l=0;l<10;l++)
{
for(i=0;i<4;i++)
{
tab1[i]=0;
k=0;
for (j=3;j>=-1;j--)
{
k++;
fread(&i,1,1,f);
if (i>=48 & i<=57)
tab1[j]=i-48;
else
break;
}
k=k-1;
if (k==1)
liczba=tab1[3];
if (k==2)
liczba=tab1[3]*10+tab1[2];
if (k==3)
liczba=tab1[3]*100+tab1[2]*10+tab1[1];
if (k==4)
liczba=tab1[3]*1000+tab1[2]*100+tab1[1]*10+tab1[0];
printf("%i;",liczba);
}
}
}
fclose(f);
system("pause");
}
}
Inside of the b.txt
1;12.12.1234;1;2;3;4;5;1;
2;12.12.1234;1;2;3;4;5;2;
3;12.12.1234;1;2;3;4;5;3;
and i am using Dev++
Thanks for help =]