Go to most recent revision |
Blame |
Last modification |
View Log
| RSS feed
/*
*
*
*
*/
#include <ll/i386/cons.h>
#include <drivers/keyb.h>
#include <stdio.h>
#include <string.h>
int main
(int argc
,char *argv
[])
{
char buffer
[256];
FILE
*fin
;
int res
;
int c
;
int flag
=1;
/* prova di rewind() */
cprintf
("opening...\n");
fin
=fopen("/TEMP/ALFA1.TXT","r");
cprintf
("opened!\n");
cprintf
("res=%p\n",fin
);
if (fin
!=NULL
) {
REDO
:
while (!feof(fin
)) {
cprintf
("reading...\n");
res
=fread(buffer
,1,sizeof(buffer
)-2,fin
);
cprintf
("read!\n");
cprintf
("res=%i\n",res
);
buffer
[res
<sizeof(buffer
)-1?res
:sizeof(buffer
)-1]='\0';
cprintf
("'%s'\n",buffer
);
}
if (flag
) {
flag
=0;
cprintf
("rewinding...\n");
rewind(fin
);
cprintf
("rewinded!\n");
goto REDO
;
}
cprintf
("closing...\n");
fclose(fin
);
cprintf
("closed!\n");
}
cprintf
("[press 'x' to exit]\n");
while ((c
= keyb_getch
(BLOCK
)) != 'x') ;
return 0;
}