problem with sscanf in email client



Hi everyone. I need a little bit help here...I have an assignment and
it is working fine until the last part which I can't solve. So here's
the code in simple form

#define maxlength 200


while( fgets( command, MAXLLENGTH, stdin ) != NULL )
{

if( sscanf( command, "%c %d%c%d", &c, &d ,e, &f)) {
switch( c ) {
case h = print the synopsis of all emails.
*if an integer is entered after h, then print the synopsis of
that message only
example h1 will print the synopsis of message 1 only
* if the input is h1-5 then it will print the synopsis
message 1 until 5

case p = print the real message (with the content ), and also
the case number such in 'h' is just the same

and so on which i have done perfectly (I guess so )....

the problem here is...

there should be a command 's', which will search a string entered in
the whole emails and printed the messages containing the string. That
means...after the command 's', we should put a string...
example: s true means it will search the string 'true' inside the inbox
and print all of them (if the subject contains true, or the contents
has a word 'true' )

However according to the sscanf provided above, I should put an integer
after the first command character. This is where I'm stuck at... and
yeah...I'm just learning C and the information about sscanf is too
little and rare in the internet. So I really appreciate if anyone can
give me a clue how to solve this problem. ^o^

.



Relevant Pages

  • Re: problem with sscanf in email client
    ... while(fgets(command, MAXLLENGTH, stdin)!= NULL) ... case h = print the synopsis of all emails. ... the whole emails and printed the messages containing the string. ... rest before you select or build a format string and call the *scanf ...
    (comp.lang.c)
  • Re: problem with sscanf in email client
    ... switch (command ... If I do this...Does that mean I have to use sscanf all way along for ... got the string already in which I need. ...
    (comp.lang.c)
  • TIP #185: Null Handling
    ... nulls, and command modifications for manipulating them. ... Tcl deals with strings, the universal medium for representing data. ... is know and it is an empty string, but if a respondent forgets to give ...
    (comp.lang.tcl)
  • Re: Determine how Word was launched
    ... inspect the command line used to launch Word. ... Private Declare Function GetCommandLineA Lib "kernel32" As Long ... Public Function GetCommandLineAs String ... Dim lngCmdLinePtr As Long ...
    (microsoft.public.office.developer.vba)
  • Re: Class.getMethod in classs static initializer block
    ... I just wanted to add that I had some similar code for a "command line server" project. ... static private final boolean DEBUG = true; ... {public ReturnCode runCommand(String s) ... public ReturnCode parseLine(String line) ...
    (comp.lang.java.programmer)