Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2005

Tip: Looking for answers? Try searching our database.

irritating Ctrl-M s

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruno van Dooren - 22 Mar 2005 19:33 GMT
Hi all,

i am working a some C++ software that will run both on windows and linux.
development is done on windows with VS .NET 2003.

when i view and edit source files on linux (using Vim), all windows
source files are littered with ^m characters everywhere.

why does the VS editor do this, and what can i do to make it stop doing it?

kind regards,
   Bruno.
William DePalo [MVP VC++] - 22 Mar 2005 19:58 GMT
> i am working a some C++ software that will run both on windows and linux.
> development is done on windows with VS .NET 2003.
[quoted text clipped - 4 lines]
> why does the VS editor do this, and what can i do to make it stop doing
> it?

Ctrl-m is a carriage-return (13. == 0xD).

<background ramble>
In the dark old days of teletypes and such, one character - the carriage
return - moved the print-head to the left-most spot, and another - the line
feed (ctrl/j, 10. = 0xA) moved the paper up one click. Some environments use
both characters written  "\r\n" C and C++ to signify the end of line.
</background ramble>

Any decent utitility to copy text between platforms should be able to map
"\r\n" to "\n" and vice versa.

It is folly, though, to assume that either platform is wrong not to adopt
the convention of the other.

Regards,
Will
Carl Daniel [VC++ MVP] - 22 Mar 2005 20:19 GMT
>> i am working a some C++ software that will run both on windows and linux.
>> development is done on windows with VS .NET 2003.
[quoted text clipped - 20 lines]
> It is folly, though, to assume that either platform is wrong not to adopt
> the convention of the other.

In addition to Will's comments, you can tell VS to save the file with "Unix"
line endings.  Once you've saved files with a particular line ending
convention, VS will maintain it (i.e. if it was Unix line endings when the
file was opened, it'll save it that way).

To change the line endings, do File|Save As... and click the little
drop-down arrow on the Save button to bring up the "Save With Encoding"
dialog.  Here you can pick an encoding (UTF-8, Code page blah blah, etc) and
you can pick the line endings to use.

-cd
Bruno van Dooren - 22 Mar 2005 21:26 GMT
great.
thanks for the tip.

not that i care one whit whether it is \r\n or \n, but i want it to look the
same on both platforms.
in that case, \n is the best solution.

   Bruno.

>>> i am working a some C++ software that will run both on windows and
>>> linux.
[quoted text clipped - 33 lines]
>
> -cd

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.