27.Write a program to display content of file.


Comments

  1. Waghmare Swati11:28 AM

    /*To display the content from file */
    #include
    void main()
    {
    FILE *fp;
    char ch;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf("Can't open a file");
    exit(0);
    }
    while(ch|=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);
    }

    ReplyDelete
    Replies
    1. Waghmare Swati11:39 AM

      /*To display the content from file */
      #include
      #include
      void main()
      {
      FILE *fp;
      char ch;
      fp=fopen("abc.txt","r");
      if(fp==NULL)
      {
      printf("Can not open a file");
      exit(0);
      }
      while(ch!=EOF)
      {
      ch=fgetc(fp);
      printf("%c",ch);
      }
      fclose(fp);
      return 0;
      }

      Delete
  2. pandhare Dipali11:28 AM

    /*to display the content of file*/
    #include
    void main()
    {
    FILE *fp;
    char ch;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf("/n/t cant open this file");
    exit(0);
    }
    while(ch|=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);
    }

    ReplyDelete
  3. poonam pusavale11:29 AM

    /*reading the content from file and display*/
    #include
    void main()
    {
    FILE *fp;
    char ch;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf("con't open a file");
    exit(0);
    }
    while(ch!=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);
    }

    ReplyDelete
    Replies
    1. poonam pusavale11:50 AM

      /*reading the content from file and display*/
      #include
      #include
      void main()
      {
      FILE *fp;
      char ch;
      fp=fopen("abc.txt","r");
      if(fp==NULL)
      {
      printf("con not open a file");
      exit(0);
      }
      while(ch!=EOF)
      {
      ch=fgetc(fp);
      printf("%c",ch);
      }
      fclose(fp);
      return 0;
      }

      Delete
  4. Mubin Pirjade11:33 AM

    it's a correct program!!
    #include
    #include // For exit()

    int main()
    {
    FILE *fptr;

    char filename[100], c;

    printf("Enter the filename to open \n");
    scanf("%s", filename);

    // Open file
    fptr = fopen(filename, "r");
    if (fptr == NULL)
    {
    printf("Cannot open file \n");
    exit(0);
    }

    // Read contents from file
    c = fgetc(fptr);
    while (c != EOF)
    {
    printf ("%c", c);
    c = fgetc(fptr);
    }

    fclose(fptr);
    return 0;
    }

    ReplyDelete
  5. Sayali Daunde11:33 AM

    //Read and display content of file
    #include
    #include
    void main()
    {
    char ch;
    FILE *fp;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf("\ncant open a file");
    exit(0);
    }

    while(ch|=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);
    }

    ReplyDelete
    Replies
    1. unknown12:13 PM

      aaaa hawa topper!!!!!

      Delete
  6. Dipali Kore11:34 AM

    //read and display content of file
    #include
    #include
    void main()
    {
    FILE *fp;
    char ch;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf("\ncant open a file");

    exit(0);
    }
    while(ch|=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);

    }
    fclose(fp);
    }

    ReplyDelete
    Replies
    1. unknown12:14 PM

      unfortunately correct ahe ;D

      Delete
  7. mayuri magar11:37 AM

    #include
    void main()
    {
    FILE *fp;
    char ch;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf("can't open file");
    exit(0);
    }
    while(ch!=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);
    return 0;
    }

    ReplyDelete
  8. Radha ghadge11:37 AM

    #include
    void main()
    {
    FILE *fp;
    char ch;
    fp=fopen("p1.txt","r");
    if(fp==NULL)
    {
    printf("\n Can't open file");
    exit(0);
    }
    ch=fgetc(fp);
    while(ch!=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);
    return 0
    }

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. unknown12:17 PM

      aaaa hawa chuklch ki ;DDDD

      Delete
    3. known112:23 PM

      aye kharach chukaley !!!!!!!!

      Delete
  9. Bhosale Dhanashri SE311:38 AM

    //opening the file and display content dvb.txt
    #include
    #include
    void main()
    {
    FILE *fp;
    char ch;

    fp=fopen("dvb.txt","r");

    if(fp==NULL)
    {
    printf("can't open the file");

    exit(0);
    }
    while(ch|=EOF)
    {
    ch=fgetc(fp);
    printf("%C",ch);
    }
    fclose(fp);



    }


    ReplyDelete
  10. sushma jadhav11:38 AM

    #include
    void main()
    {
    FILE*fp;
    char ch;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf("can't open file");
    exit(1);
    }
    while(ch!=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);
    }

    ReplyDelete
  11. puja khandare11:47 AM

    #include
    void main()
    {
    FILE *fp;
    char ch;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf("\n can't open file");
    exit(0);
    }
    while(ch|=EDF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);
    }

    ReplyDelete
  12. Ranjit kalubarme11:53 AM

    #include
    #include
    void main()
    {
    FILE *fp;
    char ch;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf("/n/t cant open this file");
    exit(0);
    }
    while(ch!=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);

    }

    ReplyDelete
  13. #include
    #include
    void main()
    {
    FILE *fp;
    char ch;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf("cant open a file");
    exit(1);
    }
    while(ch!=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);
    }

    ReplyDelete
  14. Wadegonkar Aishwarya12:10 PM

    /*write the content into a file*/
    #include
    void main()
    {
    FILE *fp;
    char ch;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf("cant't open a file");
    exit(0);
    }
    while(ch|=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);
    }

    ReplyDelete
  15. sonali nagane12:12 PM

    #include
    #include
    void main()
    {
    FILE*fp;
    char ch;
    fp=fopen("\nabc.text","r");
    if(fp==NULL)
    {
    printf("\ncan't open file");
    exit(0);
    }
    while(ch|=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);
    }

    ReplyDelete
  16. #include
    #include
    void main()
    {
    char ch;
    FILE *fp;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf(" \n Can't open file. \t ");
    exit(1);
    }
    while(ch!=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);
    }

    ReplyDelete
  17. Bhanvase Yashoda12:17 PM

    /*Reading content from file & Display*/
    #include
    #include
    void main()
    {
    FILE*fp;
    char ch;
    fp=fopen("abc.text","r");
    if(fp==NULL)
    {
    printf("File not open");
    exit(0);
    }

    while(ch|=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }

    fclose(fp);

    }












    ReplyDelete
  18. Akshay Sidwadkar12:19 PM

    #include
    #include
    void main()
    {
    FILE *fp;
    char ch;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf("cant open a file");
    exit(1);
    }
    while(ch!=EOF)
    {
    ch=fgetc(fp);
    printf("%c",ch);
    }
    fclose(fp);
    }

    ReplyDelete
  19. unknown12:21 PM

    sonya......

    ReplyDelete
  20. Akshay Sidwadkar12:26 PM

    kai re -_-

    ReplyDelete
  21. sourabh kole12:29 PM

    kuth nai..

    ReplyDelete
  22. saurabh kole12:30 PM

    bol na

    ReplyDelete
  23. #include
    #include
    void main()
    {

    FILE *fp;
    char ch;
    fp=fopen("abc","r");
    if(fp==NULL)
    {
    printf("\n\t Cant open a file");
    exit(1);
    }

    while(ch!=EOF)
    {
    ch=fgetc(fp);

    printf("%c",ch);
    }
    fclose(fp);
    }

    ReplyDelete
  24. Awate Snehal11:19 AM

    /*Reading the content from file and display*/
    #include
    #include
    void main()
    {
    FILE *fp;
    char ch;
    fp=fopen("abc.txt","r");
    if(fp==NULL)
    {
    printf("cannot open a file");
    exit(1);
    }

    while(ch!=EOF)
    {


    ch=fgetc(fp);
    printf("%c",ch);
    }

    fclose(fp);
    }

    ReplyDelete
  25. sachita jadhav11:25 AM

    /* write content into file */
    #include
    #include
    void main()
    {
    FILE *fp;
    char str[10];
    fp=fopen(" abc","w");
    if(fp==NULL)
    {
    printf("can't open file");
    exit(0);
    }
    printf("\n enter string");
    gets(str);
    fputs(str,fp);
    fclose(fp);
    }

    ReplyDelete

Post a Comment