[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Split char i C/C++



donald_j_axel wrote:
On Thu, 05 Aug 2004 18:57:13 +0200
Anders wrote:

Henrik:

Hvad det skumle er ved strtok()?

Den ødelægger input-strengen.


Jo, den ændrer input strengen, bruger den som "buffer" og
erstatter de tegn, man tokeniserer på, med '\0'

.. og virker desuden ikke i nested loops da den benytter et static char* til at finde ud af hvor langt den er nået i strengen.

Dog kan strtok_r(char*, const char*, char**); benyttes.

Så char** bruges som den "static char*" gør i den normale udgave af strtok. Hvis man har en streng som: "Test\r\rtest" og man laver en strtok med \r, får man ikke en tom streng ved andet cr.

Det gør strsep(char**, const char*) dog.

Bo

 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *