Not quite sure, I haven't used scanf before, but it seems to me that's
it having trouble figuring out where to stop parsing one and start
parsing the other, since you have [EMAIL PROTECTED]@] crunched together like
that... sort of like if you wanted it to part TheWord into 2 words, how
would it know where one stops and the other starts? Maybe try sticking a
space ([EMAIL PROTECTED] [EMAIL PROTECTED]) in the mix, since the creator's 
name is gonna be 1
word anyway, and let it parse the rest of the line as the area name...

Richard Lindsey 

-----Original Message-----
From: Mervine, Keith [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 10, 2004 1:12 PM
To: [email protected]
Subject: Sscanf help

Greetings,
        I need to separate 3 things from my credits line.

The general format of the credits is as follows.

Credits {1  15} Palladia  The Durance of Hate~

I am using sscanf to separate out the three things I need (or at least
I'm trying.)

    if (sscanf(credits, "{%[^}]} [EMAIL PROTECTED]@]", levels, creator, area) <
3)
    log_string("Problem parsing credits string.");

    if (sscanf(levels, "%d%d", &minlevel, &maxlevel) < 2)
    log_string("Problem parsing levels from credits string.");

    trimchr = &creator[strlen(creator)];
    do {*(trimchr--) = '\0';} while (*trimchr <= ' ');


For some reason its parsing the following.

Levels  : 1 - 15   
Creator : Palladia  The Durance of Hate
?
--
What I want it to look like is simply:

Levels  : 1 - 15   
Creator : Palladia

What did I miss to have it stop after reading Palladia....?

Thanks!

-- 
ROM mailing list
[email protected]
http://www.rom.org/cgi-bin/mailman/listinfo/rom

Reply via email to