ага. а если его скомпилить в msvc, то он скомпилируется, но работать не будет там то же количество аргументов тех же типов, а результат другой. может это правда и не strtok, но какая-то функция из того же семейства.
это про тот же 2005? всё прекрасно работает, но ругается, что deprecated. просто взамен этого ввели strtok_s с дополнительным параметром char**, сохраняющим контекст. Давно пора, только мало кто уже пользуется этими функциями напрямую.
If *stringp is NULL, the strsep() function returns NULL and does nothing else. Otherwise, this function finds the first token in the string *stringp, where tokens are delimited by symbols in the string delim. This token is terminated with a ‘\0’ character (by overwriting the delimiter) and *stringp is updated to point past the token.
no subject
Date: 2005-06-17 11:36 am (UTC)no subject
Date: 2005-06-17 11:51 am (UTC)no subject
Date: 2005-06-17 12:16 pm (UTC)char *strtok(char *s, const char *delim);
The first call to strtok() should have s as its first argument. Subsequent calls should have the first argument set to NULL.
а в msdn (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_strtok.2c_.wcstok.2c_._mbstok.asp) написано
char *strtok( char *strToken, const char *strDelimit );
Each call modifies strToken by substituting a NULL character for each delimiter that is encountered.
компилируется одинаково, а работает по-разному. отлаживать можно два дня - лично проверял. :-)
no subject
Date: 2005-06-17 12:19 pm (UTC)no subject
Date: 2005-06-17 12:24 pm (UTC)no subject
Date: 2005-06-17 12:28 pm (UTC)no subject
Date: 2005-06-17 12:32 pm (UTC)а вообще - полезная функция.
char *strsep(char **stringp, const char *delim);
If *stringp is NULL, the strsep() function returns NULL and does nothing else. Otherwise, this function finds the first token in the string *stringp, where tokens are delimited by symbols in the string delim. This token is terminated with a ‘\0’ character (by overwriting the delimiter) and *stringp is updated to point past the token.
no subject
Date: 2005-06-17 12:22 pm (UTC)no subject
Date: 2005-06-17 12:25 pm (UTC)давно это было - но подобный глюк я надолго запомню.
no subject
Date: 2005-06-17 12:41 pm (UTC)no subject
Date: 2005-06-17 12:44 pm (UTC)no subject
Date: 2005-06-17 12:29 pm (UTC)милая шутка у них тогда получилась.