- From: kumanna@xxxxxxxxxxxxx (Adayapalam Appaiah Kumaraswamy)
- Date: Tue Jul 20 13:50:01 2004
Viveka Nathan K wrote:
By using strtok(), if I read the /etc/passwd file with delimiter ":",
I am not getting expected result. For example, if a line contains
the '::' is read at once instead of twice.
Is there any other way to read data with delimiter ?
I worked around this, using a dirty trick!
I used strdup to create an exact copy of this string (say x) to x2.
Then, call strtok with x. Now, whenever you get a token, the separator
would be x2[token - x - 1].
Please tell me if that worked.
Adayapalam Appaiah Kumaraswamy
1, Balaji Apartments,
32, Third Street,
Mylapore, Chennai - 600004
Other related posts: