* bug in strsep?
@ 2000-12-12 15:43 Jason Knight
2000-12-12 16:09 ` Alexandre Oliva
0 siblings, 1 reply; 2+ messages in thread
From: Jason Knight @ 2000-12-12 15:43 UTC (permalink / raw)
To: gcc-help
Hi,
Trying to use "char* strsep(char **stringp, const char
*delim)" which supposedly
"returns the next token from the string stringp which is delimited
by delim. The token is terminated with a `\0' character and stringp is
updated to point past the token."
only if I give it a delimiter that is in the string I get a seg fault,
and if I give it a delimiter that is not in the string, it returns the
entire string.
thanks
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: bug in strsep?
2000-12-12 15:43 bug in strsep? Jason Knight
@ 2000-12-12 16:09 ` Alexandre Oliva
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2000-12-12 16:09 UTC (permalink / raw)
To: Jason Knight; +Cc: gcc-help
On Dec 12, 2000, Jason Knight <jwknight@ucdavis.edu> wrote:
> Trying to use "char* strsep(char **stringp, const char
> *delim)" which supposedly
Don't pass it a string literal in stringp. The string must be
modifyable, and string literals are placed in read-only memory.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-12-12 16:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-12 15:43 bug in strsep? Jason Knight
2000-12-12 16:09 ` Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).