Thread: getting the beginig of a line in a textfile

  1. #1
    Registered User stormbringer's Avatar
    Join Date
    Jul 2002

    getting the beginig of a line in a textfile


    i trying to get from anywhere in text to the beginning of the line. i wrote this litle piece of code (just an extract from my prog):

    while((tmppos!=apos) && (c=fgetc(fr))!='\n') {		
    in size_t apos is stored the begining of the text, to make sure i wont read to far. i need tmppos to check that.

    any idea?


  2. #2
    Green Member Cshot's Avatar
    Join Date
    Jun 2002
    Why can't you just use fgets to read the entire line into a local buffer?
    Try not.
    Do or do not.
    There is no try.

    - Master Yoda

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Printing Length of Input and the Limited Input
    By dnguyen1022 in forum C Programming
    Replies: 33
    Last Post: 11-29-2008, 04:13 PM
  2. adding line numbers and concatenating a filename
    By durrty in forum C Programming
    Replies: 25
    Last Post: 06-28-2008, 03:36 AM
  3. Finding carriage returns (\c) in a line
    By JizJizJiz in forum C++ Programming
    Replies: 37
    Last Post: 07-19-2006, 05:44 PM
  4. Adding Line numbers in Word
    By Mister C in forum A Brief History of
    Replies: 24
    Last Post: 06-24-2004, 08:45 PM