Trimming special(?) characters with sscanf

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kammy
    New Member
    • Dec 2007
    • 1

    Trimming special(?) characters with sscanf

    I've got a file with data to read into a program where the fields are enclosed by []. I thought that

    sscanf(ques, "[%s]", ques);

    should work to trim the brackets off as far as I'm aware, but it only trims off the leading [ not the trailing ]. Is this because [] is used in the sscanf formatting or is there some other reason? I've tried changing to {} and () and those did exactly the same.

    Help!
  • mschenkelberg
    New Member
    • Jun 2007
    • 44

    #2
    if you want to trim off [ ] or anything from a C string the best function to use is strtok.

    Comment

    Working...