Thread: sscanf() help

  1. #1
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229

    sscanf() help

    I have this call to sscanf

    Code:
    char dummy_s[1024];
    ...
    sscanf("aaa (bbb) ccc (ddd)", "%1023s (%1023s) %1023s (%1023s)", dummy_s, dummy_s, dummy_s, dummy_s);
    sscanf returned 2, and I expected 4.

    Can someone please explain why?

    Thanks

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    Hmm okay, I think I see why now after I posted the post -

    the first closing bracket (")") is parsed as part of the second string.

    I will try to work around that.

    Thanks!

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    No problem dude. I am glad I was of such great service to you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sscanf and string handling question
    By ursula in forum C Programming
    Replies: 14
    Last Post: 05-30-2009, 02:21 AM
  2. Problem using sscanf fgets and overflow checking
    By jou00jou in forum C Programming
    Replies: 5
    Last Post: 02-18-2008, 06:42 AM
  3. Problems reading formatted input with sscanf
    By Nazgulled in forum C Programming
    Replies: 17
    Last Post: 05-10-2006, 12:46 AM
  4. sscanf question
    By Zarkhalar in forum C++ Programming
    Replies: 6
    Last Post: 08-03-2004, 07:52 PM
  5. sscanf (I think)
    By RyeDunn in forum C Programming
    Replies: 7
    Last Post: 07-31-2002, 08:46 AM