Re: strtok ( ) help



Gregory Pietsch wrote:

> send = strpbrk(sbegin, delimiters);
> if (*send != '\0')

That's wrong.
strpbrk returns NULL when no characters from delimiters
are found in sbegin.

It should be either:
send = strpbrk(sbegin, delimiters);
if (send != NULL)
or
send = sbegin + strcspn(sbegin, delimiters);
if (*send != '\0')

--
pete
.



Relevant Pages

  • Re: strtok ( ) help
    ... pete wrote: ... > strpbrk returns NULL when no characters from delimiters ... > are found in sbegin. ...
    (comp.lang.c)
  • Re: how can I save a file with a single space delimeter
    ... This type of file does use a delimiters in the strict sense of the word. ... i.e. characters 27-36 represent this field. ... I guess "Speedy" is after the equivalent of a CSV file, ... >I like to change my font to Courier New and adjust columnwidths. ...
    (microsoft.public.excel.misc)
  • Re: Label Mail Merge puts each line of address on a new label
    ... I don't understand why the delimiters are printing out since they should be ... special characters. ... If it's in Publisher, that may just be a display of ... >>> after I changed the record and field delimiters to those that Word ...
    (microsoft.public.publisher)
  • Re: Transfer table to fixed length text records
    ... it to detect the wrong number of characters per line. ... Are you sure this "well established" package is expecting a delimited ... file, not fixed length, and are you sure that you are using the exact ... same delimiters, for field, record and text, that this package expects? ...
    (microsoft.public.access.externaldata)
  • Re: Transfer table to fixed length text records
    ... Fixed length means NO delimiters of any kind. ... Your data is simply one massive string of characters. ... What I don't understand is that the text file size stays the same even though I have reduced the record size to say 298 or 299 to allow for line feed or carriage return characters. ... Are you sure this "well established" package is expecting a delimited file, not fixed length, and are you sure that you are using the exact same delimiters, for field, record and text, that this package expects? ...
    (microsoft.public.access.externaldata)