previous | start | next

Parsing Problem using sscanf

    argv[0] = "fg";
    argv[1] = "%2"; or argv[1] = "1400";
    argv[2] = NULL;

    int pid;
    int jid;

    int ret;

    ret = sscanf(argv[1], "%d", &pid);

or

    ret = sscanf(argv[1], "%%%d", &jid);

   

If ret is 0 for one of these, the conversion failed. So try the other one.



previous | start | next