Read file

This is a discussion on Read file within the C Programming forums, part of the General Programming Boards category; Ok so I made 2 parts to my program and I need to make the third and (hopefully) last part ...

  1. #1
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    230

    Question Read file

    Ok so I made 2 parts to my program and I need to make the third and (hopefully) last part of it. So I will explain what the other parts do, one part has the user input the date and a string of text. then it puts it into a .txt file to be accessed later. And one part makes the date in the form of a number, kind of like this...
    january = 01,
    the first of the month = 01,
    the year = 2010.
    then it puts it all together to equal 01012010

    I just need to find a way so the program can read the text file, look for all the lines that start with that code and put the text that follows on the screen. but I dont know if there is a function that can read individual lines or not, or if there is already a function for this or something. So please help. thanks.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    fgets will read a line into a buffer, sscanf will parse it.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    230

    coo beans

    cool beans, thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File Handling -Read write and edit a file
    By aprop in forum C Programming
    Replies: 3
    Last Post: 02-27-2010, 01:01 PM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  4. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21