Thread: Help is needed, reading a string

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    26

    Question Help is needed, reading a string

    Hi all:

    I need to read a string from a file as following:

    long custid - 2 - 12 "No bugs"



    I am thinking of using fscanf(), but the problem is that fscanf() will stop while encountering a space. I want to read "No bugs" as a whole word.

    Any ideas?

    Cheers

  2. #2
    Registered User
    Join Date
    Sep 2008
    Posts
    26
    The outcome I want:

    long custid - 2 - 12 "No bugs"

    After I read from the file:

    long
    custid
    -
    2
    -
    12
    "No bugs"

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You should search on this question, since I believe that exact example was used here not an incredibly long time ago.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. reading text file to struct help needed!
    By werdy666 in forum C++ Programming
    Replies: 2
    Last Post: 01-25-2009, 11:37 AM
  2. C String Problem: Not reading end of string
    By sedavis4 in forum C Programming
    Replies: 5
    Last Post: 11-17-2008, 10:29 PM
  3. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM
  4. Reading characters from a string?
    By ladysniper in forum C++ Programming
    Replies: 6
    Last Post: 04-08-2006, 11:45 PM
  5. Calculator + LinkedList
    By maro009 in forum C++ Programming
    Replies: 20
    Last Post: 05-17-2005, 12:56 PM