Advertisement
Guest User

read to file

a guest
Sep 14th, 2016
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. int main(){
  3.     FILE *file_to_read;
  4.     char penampung[50];
  5.  
  6.     file_to_read = fopen("only_one.txt","r");
  7.     if(file_to_read == NULL){
  8.         printf("Tidak bisa membuka file\n");
  9.         return 1;
  10.     }else{
  11.         fgets(penampung,50, file_to_read);
  12.         printf("%s\n", penampung);
  13.         fclose(file_to_read);
  14.         return 0;
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement