writing and reading files

This is a discussion on writing and reading files within the C Programming forums, part of the General Programming Boards category; I am trying to learn c programming, so far i'm able to write simple programs, My problem is how to ...

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    1

    writing and reading files

    I am trying to learn c programming, so far i'm able to write simple programs, My problem is how to write the data generated to files and retrieve them later. the difference between text and binary files is vague to me, i was able to write my non character data to a text file but is at a lost on how to retrieve it. Are data sent to files indexed according to their original variable index. I read that fscanf is used to retrieve data from files but i dont know to which part of the syntax i should write the variable index. the concept of pointers is foreign to me. Is this what pointers are for? if so, please educate me on pointers, i've been reading on the topic but is at a lost on how to use it.

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Text is if you want to print out things like "Hello". Binary is if you want to dump actual values of numbers which the computer natively understands.

    If you know how printf() works, fprintf() is very similar.

    I think you may be rushing things a little. You probably want to consult a tutorial or book on file I/O and maybe I/O in general.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. reading and writing files
    By jcafaro10 in forum C Programming
    Replies: 8
    Last Post: 04-08-2009, 10:36 PM
  2. reading and writing to files
    By cgod in forum C++ Programming
    Replies: 2
    Last Post: 10-16-2004, 10:00 PM
  3. Reading and Writing from files
    By dutch's finest in forum C Programming
    Replies: 8
    Last Post: 03-18-2004, 03:34 AM
  4. reading and writing to files in windows
    By Dohojar in forum Windows Programming
    Replies: 8
    Last Post: 06-26-2003, 02:07 AM
  5. Reading binary files and writing as text
    By thenrkst in forum C++ Programming
    Replies: 8
    Last Post: 03-13-2003, 09:47 PM

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