I'm not sure if this is the cause, but you must call apr_initialize() or
 apr_app_initialize() before you use APR.

http://apr.apache.org/docs/apr/trunk/group__apr__library.html


xu li wrote:
> i want to use apr_strtok to split the string.but it failed.
> 
> my_test.c:
> #include <stdio.h>
> #include "apr_strings.h"
> int main(void)
> {
>         char *strToSplit = "Hello world";
>         char *last;
>         char *strResult;
> 
        apr_initialize();
        atexit(apr_terminate);
>         strResult = apr_strtok(strToSplit," ",&last);
> 
>         printf("%s\n",strResult);
> 
> 
>         return 0;
> }
> it failed at apr_strtok.c line 51   **last = '\0';
> The gdb infomation :
> Program received signal SIGSEGV, Segmentation fault.
> apr_strtok (str=0x80485d8 "Hello world", sep=0x80485e4 " ", last=0xbfff7740)
>     at strings/apr_strtok.c:51
> 51              **last = '\0';
> 
> could someone tell me the reason?
> Thanks in advance.
> 
> ------------------------------------------------------------------------
> Mp3疯狂搜-新歌热歌高速下
> <http://music.yahoo.com.cn/?source=mail_mailbox_footer>

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to