Hi this is the code -

-----------------------------------------------------------
Code:
FILE *fp = fopen ("C:\\Temp\\in2.txt", "r");

fgets(line, sizeof(line), fp);

printf("line is %s\n", line);
sub_str = strtok_r(line, "~");
printf("Printing strings - %s \n", sub_str);

sub_str = strtok_r(NULL, "~");
printf("Next string - %s \n", sub_str);
--------------------------------------------------------

The line is -
ITem~G!!~~~~34

The O/P is -
ITem
G!!

HOW CAN I EXTRACT THE NULL VALUES ALSO IN BETWEEN? STRTOK() IGNORES IF THERE ARE NULL IN BETWEEN....

Please help.

Last edited by shabbir; 19May2007 at 14:51.. Reason: Code block - http://www.go4expert.com/forums/misc.php?do=bbcode#code