home *** CD-ROM | disk | FTP | other *** search
- @* An example of some stdio library routines *@
-
- main()
- {
- char text[40];
- int fileptr, i;
-
- bbc_mode(12);
-
- sprintf(text,">>TEXT<<");
- printf("This is a simple stdio test program: %s\n",text);
-
- fileptr = fopen("testfile","w");
- if(!fileptr)
- puts("Can't open output file!");
- else
- {
- for(i=0; i<20; i++)
- {
- fprintf(fileptr,"\nThis is some text in a file (line %d).",i+1);
- }
- fclose(fileptr);
- }
-
- for(fileptr=fopen("testfile","r"); !feof(fileptr);)
- {
- fgets(text,39,fileptr);
- if(!feof(fileptr))
- printf("%s",text);
- }
- fclose(fileptr);
-
- remove("testfile");
- }
-