"Everything is a file".
When we say that everything is a file in linux what does it basically means,because in windows also we can find a file for everything eg for printer or any device or any log.
Thanks. |
It means that devices live in /dev, memory can be directly access under /proc etc., whereas a windows printer is NOT a file. you can't literally write text to a printer file in windows and see it come out on paper. You really can do this on Linux (echo "THIS IS A TEST" > /dev/lp0) etc. A simpler example is a disk, you can open up /dev/sda1 in a text editor if you so desire and see the raw contents of a disk.
Note though that whilst it's nice to say so, LOADS of things actually aren't files. Like sound and network interfaces in most cases these days (I think) |
If lets say printer is not a file in windows then how come other programs able to use it?,what do they actually uses to have access on printer?
i.e if I want to use a printer in my program I will have to access printer's device driver. |
*you* don't use the driver, there's no actual file that IS the printer. It disappears into hardware abstraction code and gets dealt with like that. I don't know all that much about how it works, but the basic point here is there is no c:\windows\systems32\davesprinter.prn or something similar.
Actually, there are shitty remnants of this is the DOS environment I believe. On unix you can run "echo TEST > /dev/ttyS0" which would write the word "TEST" to the first serial port, there IS a file at /dev/ttyS0. On windows the same would be "type TEST > COM1" But note here that COM1 is NOT a file. It was just a nasty nasty hack where using the word "COM1" would be arbitrarily pulled out of the ether and sent into the 1st serial port, rather than a file called "COM1" |
Quote:
|
All times are GMT -5. The time now is 04:19 PM. |