Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

How to save the file in unix format

2004-09-22
2012-09-26
  • The files are being saved in "Windows format" with '\r' at the end of every line.
    I am having to do "dos2unix" everytime before compiling on my linux machine to remove the '\r'.
    Can I save the file in unix format on Dev C++ directly?

    Thanks.

     
    • qWake
      qWake
      2004-09-22

      It's not so much a function of the program as it is a function of the operating system. The Macintosh marks an end of line with '\r', Linux and Unix use '\n' instead, and DOS and Windows use both. I don't believe there is any switch within Dev-C++ to select from these three options since Dev is a Windows program, so you will probably have to keep doing the dos2unix dance. Sorry!

      qWake

       
    • are they networked?

      if so you could use ftp and an ftp script to send all the source. in ascii mode it should remove the \r itself saving you the trouble.

      obag

       
      • Thanks for the quick replies.

        I am directly saving the files on to my linux box by mapping the drive from Windows. Does that change anything? Let me know if you need more information.

        Thanks.

         
    • joe
      joe
      2004-09-23

      I installed linux on my primary machine on a second HD and use a floppy boot to get into linux....I use a USB flash card reader to transfer files between the two systems...my experience was that the IDE's (dev-c++ on windows, and KDE in Linux) were smart enough to take care of the line breaks. The difference shows up when looking at files in notepad, but it is immaterial within the IDE.

      It's been a while since I did this, but I believe my recolection's sound.

      I know for a fact that unix-linefeed files will work with no issues in dev-c++. I think it's should be a non-issue for .h and .cpp files, but it may be an issue if your compiled program needs to read/use text that are in the wrong format. If that were the case, I'd see if I my editor would take care of the conversion for me...

       
    • Jim W.
      Jim W.
      2004-09-22

      Another possibility that might make it at least a little more convenient would be to make a batch file (or write a little utility) that does what you want and set it up as a Dev tool. I believe the Tool "macros" can deliver up the source file names....

      -- Jim.

       
    • Jim W.
      Jim W.
      2004-09-23

      Heck -- Let us know whether or not that worked....

      -- Jim.