C program to Read From a File

#include <stdio.h>
#include <stdlib.h>
void main()
{
    FILE *fptr;
    char filename[15];
    char ch;
    printf("Enter the filename to be opened \n");
    scanf("%s", filename);
    /*  open the file for reading */
    fptr = fopen(filename, "r");
    if (fptr == NULL)
    {
        printf("Cannot open file \n");
        exit(0);
    }
    ch = fgetc(fptr);
    while (ch != EOF)
    {
        printf ("%c", ch);
        ch = fgetc(fptr);
    }
    fclose(fptr);
}

Reactions:

28 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. its all up to you

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. 7 ways to be a better programmer:
    1.Check Your Code First Before Looking to Blame Others
    2.Continuous Learning
    3.Don’t Be Afraid to Break Things
    4.The Professional Programmer
    5.Take Advantage of Code Analysis Tools
    6.Ubuntu Coding for Your Friends
    7.You Gotta Care About the Code

    ReplyDelete
  6. http://download-16-cs.blogspot.ro

    ReplyDelete
  7. The government should be blamed for not taking actions against the government schools which have fail to give quality education. On the other hand we get higher education from private schools but we have to pay a lot for it.
    Pakistan Education News

    ReplyDelete
  8. Great blog posts, it really like to reading of this best education from with private school. Thanks for shared it, Oswaal Books

    ReplyDelete

  9. this is really a very great blog. the information present in this blog will be very useful for us. thank you for sharing with us.
    SEO Company In Chennai

    ReplyDelete
  10. Very Nice Blog I Have Read Your Blog It Is Very Interesting And useful For Computer Science Projects Thank You For Posting and Sharing With Us And Please Give Me More Information About Computer Projects
    final year project for computer science.

    ReplyDelete
  11. Such a great articles in my carrier, It's wonderful commands like easiest understand words of knowledge in information's.

    Hadoop Training in Chennai

    ReplyDelete
  12. Cat6 Cable Manufacturers Supplier

    We have gained a huge popularity in the market by offering excellent quality assortment of Cat6 Cable Manufacturers Supplier. These are manufactured from high grade raw materials and latest technology by our expert team. Best quality and low prices we are supplier. Call us +91 98990 00668.

    mandeepcables.com/cat-6-product-770606.html

    ReplyDelete

  13. नोटबंदी के 50वें दिन, मोदी सरकार के फैसले से निराश हैं जनता
    Readmore todaynews18.com https://goo.gl/NJUQY9

    ReplyDelete
  14. Great post! I am actually getting ready to across this information, It's very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.

    AWS Training in Chennai

    ReplyDelete
  15. Wonderful bloggers like yourself who would positively reply encouraged me to be more open and engaging in commenting.So know it's helpful.
    New Zealand Education Consultants in Chennai

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. There are lots of information about latest technology and how to get trained in them, like this have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies. By the way you are running a great blog. Thanks for sharing this.

    Painless Dental Treatment In Chennai

    Best Dental Clinic In Adyar

    ReplyDelete
  18. Hi Dear,

    I see your blog daily. your blog is very useful for me & i like so much..


    chemistry tuition - Best Award Winning Tuition Centre since 1999, helping students achieve OUTSTANDING results. Effective methodologies for PSLE, Secondary, O, A Level, JC H2 tuition
    Visit : http://www.smartlab.com.sg/Tuition

    ReplyDelete
  19. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.

    iOS App Development Company

    ReplyDelete
  20. Hello Guy
    Do you want to play game in casino online
    Please Click Here now
    thank you
    จีคลับ
    บอลออนไลน
    gclub online

    ReplyDelete

  21. Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well as giving..
    Android App Development Company

    ReplyDelete