tags:

views:

53

answers:

1

suppose a text file has 11001100 11001101

and i open the text file and take the input from the file as pt[0]=11001100, pt[1]=11001101..

but if i take the input from file as in>>pt it wont put it in two different arrays which is obvious but it takes the whole line . Thus I have to take another for loop and traverse through the whole string and when I find a null character i start putting into the second array . But how can I do it without putting it into a variable and traversing .. I mean directly from the file itself ..

A: 

Read it one byte at a time (e.g. with fread()). Append each byte to pt[i], where i is incremented when a space is encountered.

Sjoerd