The code is all there. You've posted it all.
It reads each character one by one and interprets them according to whatever type it's trying to read.
If the type is a char it just reads a single character into the variable.
If the type is a bool it reads sizeof(bool) characters into the variable. (That's a bug if this is supposed to be workable across platforms which, considering the trouble they go to for ints, seems likely.)
If it's an int it reads bytes and puts them into the int until it gets to one with the top bit set. So each character in the file provides 7 bits. There's some fiddling I can't follow without paper and pencil for signed ints.
If it's a string then it reads a length number first then that number of bytes are read into the string.
Vectors, sets and maps work the same except the elements are read as the types they are and each map element is read as a pair.
pairs and tuples are read as just their individual elements of whatever types they are.
So the file doesn't hold text; it holds binary data that is only understandable if you know what values of what types occur in what order.
Code: Select all
ibstream &ibs
ibs >> device
>> width
>> height
>> n_nets
>> packages
>> loc_pin_glb_num
The first read is device. device is a string. So it reads a string into device. The next is width, which is an int. So it reads an int into width. And so on.