473,387 Members | 3,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

irritating Ctrl-M s

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.
Nov 17 '05 #1
3 1328
"Bruno van Dooren" <br**********************@hotmail.com> wrote in message
news:et**************@TK2MSFTNGP09.phx.gbl...
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?


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

Nov 17 '05 #2

"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:en**************@TK2MSFTNGP10.phx.gbl...
"Bruno van Dooren" <br**********************@hotmail.com> wrote in message
news:et**************@TK2MSFTNGP09.phx.gbl...
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?


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.


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
Nov 17 '05 #3
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.
"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:uS**************@tk2msftngp13.phx.gbl...

"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:en**************@TK2MSFTNGP10.phx.gbl...
"Bruno van Dooren" <br**********************@hotmail.com> wrote in
message news:et**************@TK2MSFTNGP09.phx.gbl...
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?


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.


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

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Mike Maxwell | last post by:
<vent> I see there has been traffic over the years on this gripe, so just let me vent my frustration, and add another reason why 'exit' (or possibly exit() or quit() or halt() or some such) should...
4
by: Scott | last post by:
I am using a TCPIP connection to communicate over port 23 (telnet) to a server, and I am having to mimic normal command line interface you owuld see in a telnet session (i.e. I have to write to...
10
by: chirs | last post by:
I have a code to disable ctrl-v (paste) on the 2nd box. The problem is that when I type ctrl-v, the text shows, then disappear after I release ctrl-v. How can I make it not to show in the box. In...
3
by: Greg | last post by:
I want to be able to capture the user pressing Ctrl+S. I know that the IE browser has a key binding for Ctrl+S but is there any way that I can be notified of this key press anyway. I have found...
3
by: Glen Hong | last post by:
I have set up a hotkey using RegisterHotKey API function for Ctrl-Tab. Firstly, I can rap this when Ctrl-Tab is pressed however if I want to add an addition hotkey how can I distinguish between...
2
by: crjunk | last post by:
I'm trying to write a piece of code that will programatically save a record automatically without me having to add a new ' Row.Item("ADD1") = txtAdd1.Text.Trim.ToUpper ' type command each time I...
2
by: s99999999s2003 | last post by:
hi i have a program that works very similar to tail -f in Unix It will need a Ctrl-C in order to break out of the program. I wish to run this program using python (either thru os.system() or some...
11
by: Bookham Measures | last post by:
Hello As above, my Ctrl + Spacebar for intellisense is not working in VI 6.0. I have checked keyboard assignments and Ctrl + Space is listed for Edit -> CompleteWord. I added Ctrl + Shift +...
21
by: Zytan | last post by:
Instead of Ctrl+Y redoing what's stored in 'future history', it REPLACES that information (which will then be forever lost) with a new command: delete current line. This shortcut is so ridiculous...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.