home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_200
/
253_01
/
anyfile.c
< prev
next >
Wrap
Text File
|
1990-02-14
|
640b
|
30 lines
/* Chapter 10 - Program 7 */
#include "stdio.h"
void main()
{
FILE *fp1;
char oneword[100],filename[25];
char *c;
printf("Enter filename -> ");
scanf("%s",filename); /* read the desired filename */
fp1 = fopen(filename,"r");
do {
c = fgets(oneword,100,fp1); /* get one line from the file */
if (c != NULL)
printf("%s",oneword); /* display it on the monitor */
} while (c != NULL); /* repeat until NULL */
fclose(fp1);
}
/* Result of execution
(The file selected is listed on the monitor)
*/