510 Subj : Re: String memory Allocation To : borland.public.cpp.borlandcpp From : Ed Mulroy [TeamB] Date : Sun Oct 03 2004 04:38 pm > Or a pointer inside that string. ... Yes, that is what I said, a pointer to the memory which was passed to the function when it was called. > , i.e. if the first argument is 0, strtok() is to > continue the previous tokenization. For this > to work, strok() needs some internal memory.... Unless it has changed significantly from how the RTL in BC++ does it versus that in BCB, and BCB's C-style functions generally mimic those in the 32 bit BC++ RTL, there is a per-thread pointer, 4 bytes, used by strtok, part of the per-thread memory block pointed to by TLS. .. Ed > Thomas Maeder wrote in message > news:m2655ritne.fsf@madbox2.local... > "Ed Mulroy [TeamB]" writes: > > Or a pointer inside that string. > > To tokenize > > char input[16] = "abc,d,efg"; > > at ',' boundaries, you'd first do > > char const *firstToken(strtok(input,",")); > > and then, until strok() returns 0, > > char const *subsequentToken(strtok(0,",")); > > , i.e. if the first argument is 0, strtok() is to continue > the previous tokenization. For this to work, strok() > needs some internal memory. . 0