strtok



  • warum geht das nicht?

    char* pToken;
    char* dirName = "/FOO_0_0/FOO_0_0.TXT";
    pToken = strtok(dirName, "/");
    

    gibt nen fehler in strtok:
    /* Find the end of the token. If it is not the end of the string,
    * put a null there. */
    for ( ; *str ; str++ )
    if ( map[*str >> 3] & (1 << (*str & 7)) ) {
    *str++ = '\0'; <---------------

    Unhandled exception at 0x102af11e (msvcr80d.dll) in Test.exe: 0xC0000005: Access violation writing location 0x00423f70.

    cu



  • strtok versucht die '/' mit nullen zu tauschen.
    weil der string 'read only' ist, schmiert's ab...



  • Um tens Beitrag auch noch eine potentielle Lösung hinterherzuschieben:

    char dirName[] = "/FOO_0_0/FOO_0_0.TXT";
    

Anmelden zum Antworten