Thread: fscanf question

  1. #1
    Registered User
    Join Date
    Sep 2005

    fscanf question

    is there a way to make fscanf read in a whole string with blanks inlcuded.... i know fscaf ... or scanf stops when it encounters a blank, is there a way around this? So I can store a sentence?

  2. #2
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Sure, use function fgets!
    Do a little board serch for fgets, and you'll find it
    Gotta love the "please fix this for me, but I'm not going to tell you which functions we're allowed to use" posts.
    It's like teaching people to walk by first breaking their legs - muppet teachers! - Salem

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Or a FAQ search.

    Yes, you can make scanf read entire lines. However, fgets is much better for this sort of thing. The FAQ contains entries on getting a line from the user.

    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fscanf in different functions for the same file
    By bchan90 in forum C Programming
    Replies: 5
    Last Post: 12-03-2008, 08:31 PM
  2. Quick question about fscanf
    By zyphirr in forum C Programming
    Replies: 16
    Last Post: 11-24-2008, 08:44 PM
  3. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 08:22 PM
  4. quick fscanf question...
    By Ham in forum C++ Programming
    Replies: 4
    Last Post: 02-01-2003, 07:47 AM
  5. fscanf() question
    By Encrypted in forum C Programming
    Replies: 6
    Last Post: 01-20-2003, 12:14 PM
Website Security Test