Files

This is a discussion on Files within the C Programming forums, part of the General Programming Boards category; I wrote a program which stores a lot of informacion in a file, but now I have a problem I ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    24

    Unhappy Files

    I wrote a program which stores a lot of informacion in a file, but now I have a problem I want to read out information from the file but not all only some of then

    Pleas Help me!!

  2. #2
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    Is it a text file or a binary file?

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    24
    It is a text file

  4. #4
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    I don't think it's wise to use fseek (jump to a certain position in the file) when using text files.

    The best way to do this is by reading all lines from the file (with the fgets function) and copy the information you need.

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231

    Re: Files

    Originally posted by PawelK
    I wrote a program which stores a lot of informacion in a file, but now I have a problem I want to read out information from the file but not all only some of then

    Pleas Help me!!
    Post some code that you're having trouble with (ie not the whole program, just a snippet or two).
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  6. #6
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Location
    Bangalore, India
    Posts
    345
    >I wrote a program which stores a lot of informacion in a file, but now I have a problem I want to read out information from the file but not all only some of then

    If you know where you have stored what, you can just jump (seek) to the offset in the file and read what you want, else you'll have to run through the whole file looking for what you need.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ressources files
    By mikahell in forum Windows Programming
    Replies: 4
    Last Post: 06-19-2006, 07:50 AM
  2. add source files to embedded VC 4.0
    By George2 in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 04:28 AM
  3. *.cpp and *.h files understanding
    By ElastoManiac in forum C++ Programming
    Replies: 4
    Last Post: 06-11-2006, 05:45 AM
  4. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  5. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 02:41 PM

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