Herbert Voss <[EMAIL PROTECTED]> writes:

| Lars Gullik Bjønnes wrote:
>
>> As it is not you are not all-files-type-proof, if I tried to load the
>> lyx binary as a graphcs file it would most likely fail, or just read
>> _a lot_ too much.
>
| please edit, I never did it in this way (reading from a file)
| support/filetools.C - getExtFromContents()
>
| char dummy[64];     // my brain thinks binary ...
>
| [...]
>
|       ifs.read(dummy, 64);
|       str = string(dummy);
| [...]

actually we can easly argue that what we read in is not a string but
an array of bytes, but to make comparisons easier it is proabably
easiest to stay with string.

char char_array[64];
int read_n = ifs.readsome(dummy, 64);
string str(dymmy, read_n);

unfortunately readsome is missing in a lot of sub-standard C++
libraries.

-- 
        Lgb

Reply via email to