reading in file question

This is a discussion on reading in file question within the C++ Programming forums, part of the General Programming Boards category; im reading in a file line by line as such: fscanf(fpin,"%d\t%d\t%s",&startpos,&endpos,name); the file is like this: 0 100 john doe ...

  1. #1
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455

    reading in file question

    im reading in a file line by line as such:

    fscanf(fpin,"%d\t%d\t%s",&startpos,&endpos,name);

    the file is like this:

    0 100 john doe

    but for name, it only reads in "john",
    how would iget it to read in the entire thing?

  2. #2
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455
    nvm i got it, here it is for anyone else who needs it

    fscanf(fpin,"%d\t%d\t%[^\n]s",&startpos,&endpos,name);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 04:02 AM
  2. Newbish Question file reading question....
    By kas2002 in forum C Programming
    Replies: 23
    Last Post: 05-17-2007, 12:06 PM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  4. question about reading in strings from a file :>
    By bball887 in forum C Programming
    Replies: 8
    Last Post: 04-13-2004, 06:24 PM

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