[Ilugc] strtok
Gopalarathnam V
gopalarathnam at gmail.com
Tue Jul 20 13:48:51 IST 2004
You can use strchr() itself. It would return you the ptr to the first
occurance of the char in ptr, which you can increment by 1 each time
to get the next occurance.
Also, avoid using strtok(), as it is not thread safe.
If you are writing C++ progs, use strstream.
On Tue, 20 Jul 2004 11:34:23 +0530, Viveka Nathan K <vivek at indofuji.com> wrote:
> Hi..
>
> By using strtok(), if I read the /etc/passwd file with delimiter
> ":",
> I am not getting expected result. For example, if a line contains
>
> rpm:x:37:37::/var/lib/rpm:/bin/bash
>
> the '::' is read at once instead of twice.
> Is there any other way to read data with delimiter ?
>
> Thanks,
> --
> Viveka Nathan K
> IndoFuji Information Technologies Pvt Ltd., Bangalore 560 076.
> www.indofuji.com Ph: 080-26784122/33/55 (ext) 46
> _______________________________________________
> To unsubscribe, email ilugc-request at ae.iitm.ac.in with
> "unsubscribe <password> address"
> in the subject or body of the message.
> http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
>
--
Gopalarathnam V.
#include <disclaimer.h>
More information about the ilugc
mailing list