source code:
-------------------------------------------------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
int main ()
{
FILE *fp;
int c;
char fn[50];
printf("masukkan nama file : ");
scanf("%s",fn);
fp = fopen(fn,"r");
if(fp==NULL)
{
puts("file tidak ditemukan!");
exit(1);
}
while(1)
{
c = fgetc(fp);
if( feof(fp) )
{
break ;
}
printf("%c", c);
}
fclose(fp);
getch();
return(0);
}
-------------------------------------------------------------------------------------------------------------------
baca juga : fungsi strstr() bahasa c.
.
No comments:
Post a Comment