[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++



Bo Simonsen skrev den 08-Aug-04:

> Anders Melchiorsen wrote:
>> Bo Simonsen <sslug@sslug> skrev:

[...]

>>>for(tp = strtok(test, " \0");
>>>     tp;
>>>     tp = strtok(NULL, " \0"))

[...]

>> Der indsættes automatisk nulafslutter i en tekststreng, så der er
>> ingen grund til "\0".
>
> Hvor gør jeg det?

I det, jeg har citeret ovenfor, er der unødige nuller.



Bo Simonsen skrev endvidere den 08-Aug-04:

> Anders Melchiorsen wrote:

[...]

>> Den ødelægger input-strengen.
>
> Det sætter blot et \0 hvor token er.
>
> Burde kunne repereres igen med.

[...]

> tp = strtok(text, " ");
>
> .. gør noget med tp ...
>
> *(tp+strlen(tp)) = ' ';

Dette virker kun fordi du blot søger på et enkelt tegn og derfor ved,
hvad du skal indsætte igen. Det virker ikke i det generelle tilfælde.


Anders.


 
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] *