Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows and Linux text files problem

Status
Not open for further replies.

MattRK

Programmer
Feb 3, 2002
29
US
Ok, I have a laptop with a 30 gig drive in it. I partitioned it into 3 different drives. A 5 gig for windows, a 20 gig for sharing, and a 5 gig for linux. The first drive is an ntfs file system, the second (the 20 gig) is a fat32 file system, and the last is whatever linux uses (ext2 I think). The linux partition is divided into several different partitions and mounted a differnt points. (I think like /, swap, /home)

Anyway, in windows I can see the 20 gig just fine and write files to it and everything. In linux I can see the drive (mounted as /mnt/windows). I can see text files that I created in windows. I can edit them and see the changes.

My problem is that in linux when I create a file with returns (like a new line), in windows the returns show up as a little block character. So its one big line with these little block letters where the returns should be.

Is this what it is supposed to be like? lol. I didn’t think so. The whole reason for the big drive in the middle is so that I can code in windows and then view the files in linux to test them out. Thanks for any help you can provide!!

-Mr.K
 
It's because MS-DOS and Linux define a newline differently.

MS-DOS (and by succession, Win32) uses a carriage return then a linefeed to designate a newline. Linux uses only the linefeed. Your editor doesn't know how to react.


You will also see strangeness going the other way. If you create a file on the DOS side, then open the file using joe in Linux, you'll see M at the end of each line.

______________________________________________________________________
Perfection in engineering does not happen when there is nothing more to add.
Rather it happens when there is nothing more to take away.
 
i think that wordpad can correctly handle unix style files.
 
Thanks for all your help. I found that KWrite (kde's advanced text editor) has an option to do dos, linux, or mac line endings. So i just chose dos. I also found that textpad can do the same on windows. So i'm good from both ends.

Thanks again for your help.

-Mr.K
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top