Posted by QRan93R on 20:03:00 09-28-2002
Ok, why is said that if a program is written in Linux, it can't work in Windows??? Is it because the compilers compile the programs in different binary systems????
Posted by KaGez on 22:44:00 09-28-2002
well, if you have the code at your fingertips, ANSI C programs will compile on almost any systeam out there. Same goes for ANSI C++ progs.
The problem is just that if you only have binaries, linux is unable to use the windows bins, and the other way around too. In linux you don't have "binary" files. They are _all_ text files, even binaries, just translated into stuff the ELF interpreter understands it (this is right, isn't it? :/)
Posted by Smerdyakov on 22:59:00 09-28-2002
All "text files"? I don't think so. Linux just uses a different executable format.
Posted by QRan93R on 00:40:00 09-29-2002
So, are Linux'es all files text files or are they just in other exe format, than windows?
Posted by Smerdyakov on 03:09:00 09-29-2002
I just answered that.
Posted by KaGez on 11:10:00 09-29-2002
Smerdyakov:
no, in linux there is nothing as "binary" format. really.
the binaries are even plain text files, even if you don't belive me.
and, binaries != binary
[addsig]
Posted by fsvara on 16:10:00 09-29-2002
you can look at windows .exe files in editors, too, but that doesn't make them text files.
Posted by QRan93R on 20:00:00 09-29-2002
So, you can look at the linux'es exe file with a text editor?? Will it show the source code???
Posted by KaGez on 22:02:00 09-29-2002
ok, here's the proof:
open up a image file (JPEG, PNG or anything you've got lying around), and open it in C, in linux as well as in windows.
In linux it will work with "r" mode, and windows you _need_ "rb" to read it properly, which proofs that there is no such thing as binary in linux.
try it if you still don't belive me. It took me quite a long time to figure this out when I was porting some OpenGL stuff, actually texture loading func, fron linux to windows. And, afaik, also some book mention this, that you do _not_ need the "b" option for fopen() in UNIX systems at all, because there would be no difference.
in the editor the files may look different, but if you use fread and co, you will be able to read anything from files which are handled as binary in windows.
have a nice day.
[addsig]
Posted by dxprog on 23:03:00 09-29-2002
No binary file formats?!?! I'm not sure I could live without that. It's fun making up file headers, and encrypting other binary files.
[addsig]
Posted by Smerdyakov on 01:47:00 09-30-2002
Sorry, KaGeZ, but you're quite confused. The particulars of standard C functions have nothing to do with the operating system's actual representations. Opening files in "text mode" in Linux is the same as opening them in "binary mode" simply because Linux doesn't need any extra conversions to meet the ANSI standard for text IO. This is no surprise, since the standard is based on UNIX systems, for which C was invented. A special text mode is only needed for OS's like Windows or Macintosh, where newlines in text files aren't represented by a single '\n', and every character read must be checked to see if it is '\r' followed by '\n' and replaced by a single '\n', as an example for Windows.
Posted by QRan93R on 03:46:00 10-02-2002
Oh, well. Nevermind that. When I'll donload mandrake linux 9.0, I'll experimnet with that...
Posted by KaGez on 15:59:00 10-02-2002
Smerdyakov:
ok, then just don't belive me, I'm fine with that, and I don't need you to belive me. period.
[addsig]
Posted by JWalker on 08:34:00 11-15-2002
-->ok, then just don't belive me, I'm fine with that, and I don't need you to belive me. period.
Actually, Smerdyakov is correct. Binary and text files are equivalent in Linux and UNIX systems. But in Windows systems there are conversions performed so binary and text files are treated differently by the C I/O functions.
-JW
Posted by KaGez on 21:32:00 11-15-2002
that makes _my_ opinion right... doesn't it? :/
[addsig]
Posted by fsvara on 04:07:00 11-16-2002
well, in that case, i believe we can talk about "facts", not "opinions"