On 3/29/07, glogic_1 <[EMAIL PROTECTED]> wrote: > > Hey all > Just a general query about binary files. Now im aware that getLine > doesnt work with binary files but im wondering why this is what > actually happens? i checked it out on the net and all the info i found > was abit over my head.. can anyone break it down into noob english?
A text file is lines separated by linefeeds (a byte or series of bytes "unlikely to occur within a line.") A binary file is just a huge 'lump' of data. Thus a binary files don't have 'lines' as such (though a/few byte(s) within such a file may have the right combination of bytes to mark a line delimiter, these aren't "seen" as such.) If you open a text file in binary mode, linefeeds just 'blur' into the rest of the file and 'stop existing' (for the purposes of getline() e.g.) and also what do i have to watch out for when porting binary files > from one computer architecture to another? in some of the info there > were references of a danger in doing this but never went into detail.. > any ideas what this means? There are two issues that spring to mind - one affecting 'binary' files, the other 'text' files. The only thing I could possibly think of affecting binary files would be endianess of numbers stored within the file when moved from one architecture to another. (One system thinks the first byte is the high byte of an integer, the other thinks it's the low byte, for example) For text files however, different systems (read 'operating systems' loosely) have different byte representations of what a 'linefeed' is. If you move a text file in binary mode, what were linefeeds on the original system become garbage on the destination. -- PJH Aio, quantitas magna frumentorum est [Non-text portions of this message have been removed]
