Ada*_*eld 15

它不是那么有用printf(),但它可能非常有用sscanf(),特别是如果你在多次迭代中解析一个字符串. fscanf()scanf()根据读取的输入量自动推进其内部指针,但sscanf()不会.例如:

char stringToParse[256];
...
char *curPosInString = stringToParse;  // start parsing at the beginning
int bytesRead;
while(needsParsing())
{
    sscanf(curPosInString, "(format string)%n", ..., &bytesRead);  // check the return value here
    curPosInString += bytesRead;  // Advance read pointer
    ...
}
Run Code Online (Sandbox Code Playgroud)


e.J*_*mes 5

它可以用来执行邪恶的行为.