1. Open the specified text file with VI: VI filename.c
2. Press the ESC key to enter the command mode;
3. Press: Key (press Shift key, press: Key at the same time) enter the command input state;
4. After the colon, enter:%s/^m//g
Note: ^m is a character that is not input ^ and m two characters,
That is, hold down the CTRL key and press the V key to generate ^, still hold the CTRL key, and press M to produce m.
5. Press the Enter key to execute the Replace command
6. Press: Key (press Shift key, press: Key) to enter the command input state;
7. After the colon enter: Wq <--Save changes
8. Press the Enter key to execute the Save command
File encoding method and line terminator settings in the IDE:
1) in the VS2008 under Window,
Click the menu [file]->[advanced Save Options ...],
In the Advanced Save Options dialog box that pops up,
Set Encoding to Unicode (UTF-8 with signature)-Codepage 65001
Set line endings to Unix (LF)
2) in the code::blocks under Ubuntu,
Click on the menu [Settings]->[editor ...],
In the "Configure Editor" dialog box that pops up,
Click the General Settings option in the left-hand box
Set the Encoding in the Options group
Use encoding when opening files is UTF-8
Use this encoding as default encoding (bypassing C::b ' s auto-detection)
In the End-of-line Options group, set the
End-of-line MODE:LF
Reprint VI replace Windows line break with Linux newline character