Extract fields from a character array in c++?

Suppose if I have a character array in the following format

2|310456|Acton Golden|Advertising|P3|Hyderabad
i.e

char text[]="2|65412|Harry Wilkins|Developer|Paris"

I have a 2D array of type char

 
  char data[5][20];


How can I extract each column from that particular line and store in this character array? I want to store

data[0]="2"

data[1]="65412"

data[2]="Harry Wilkins"

data[3]="Developer"

data[4]="Paris"

Please help
http://www.cplusplus.com/faq/sequences/strings/split/

In particular, you can use an stringstream and getline:
http://www.cplusplus.com/faq/sequences/strings/split/#getline

Hope this helps.
Topic archived. No new replies allowed.