[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] File Copying



"Ian Mallett" <geometrian@xxxxxxxxx> asked:
> So that would explain why .png didn't work, but then why did it work with
> .txt?

Win32's file handling handles certain characters specially: 0xff is
interpreted as an end-of-file marker, even if it occurs in the middle of
the file, also carriage return/line feeds are parsed in a 'best guess' of
what you might mean, as opposed to what's literally in the file.

With text files, this tends to work out fine, though. You're not going to
have weird non-printable characters interspersed in your file.

With binary files (like graphics images, where all byte values need to be
able to be represented), opening them in ASCII mode on Win32 will cause
corruption if your file contains any of these special characters.


However, this isn't really a pygame issue.

-Dave LeCompte