vs2015使用外部工具改变行尾CRLF->LF
来源:互联网 发布:网络咨询医生话术 编辑:程序博客网 时间:2024/05/18 01:04
VS2015不支持addin和宏了,所以只能手动操作:
(如果用unity的C#脚本,建议高级保存设置成CRLF模式,因为VS2015智能格式化代码是CRLF,修改不了设置,每次他智能缩进都需要ctrl+z,才可以去掉CR,但是这样影响了写代码的速度)
工具代码:
#include<windows.h>#include<iostream>#include<fstream>using namespace std;int main(int argc, char* argv[]){ if (argc != 2) { cout << "Please specify : dos2unix filename" << endl; return 0; } char ch; char temp[MAX_PATH] = "\0"; //Open the file for reading in binarymode. ifstream fp_read(argv[1], ios_base::in \ | ios_base::binary); sprintf_s(temp, "%s.temp", argv[1]); //Create a temporary file for writing in the binary mode. This //file will be created in the same directory as the input file. ofstream fp_write(temp, ios_base::out \ | ios_base::trunc \ | ios_base::binary); while (fp_read.eof() != true) { fp_read.get(ch); //Check for CR (carriage return) if ((int)ch == 0x0D) continue; if (!fp_read.eof())fp_write.put(ch); } fp_read.close(); fp_write.close(); //Delete the existing input file. remove(argv[1]); //Rename the temporary file to the input file. rename(temp, argv[1]); //Delete the temporary file. remove(temp); return 0;}
工具-->外部工具-->添加:
选择自己的工具路径
参数:$(ItemPath)$(FileName)$(FileExt)
初始目录:$(TargetDir)
这样打开一个文件,点击自己的工具,就自动删除了CR。
阅读全文
0 0
- vs2015使用外部工具改变行尾CRLF->LF
- LF和CRLF使用sed工具转换
- CRLF和LF
- LF, CR, CRLF
- CRLF和LF
- CRLF、LF、CR
- git---CRLF和LF
- CRLF和LF
- git使用问题解决----warning: LF will be replaced by CRLF
- CRLF 和 LF 的关系
- windows使用git时出现:warning: LF will be replaced by CRLF
- windows使用git时出现:warning: LF will be replaced by CRLF
- windows使用git时出现:warning: LF will be replaced by CRLF
- windows使用git时出现:warning: LF will be replaced by CRLF
- 在Windows下使用git时出现 warning: LF will be replaced by CRLF in xxx.
- windows使用git时出现:warning: LF will be replaced by CRLF
- windows使用git时出现:warning: LF will be replaced by CRLF
- windows使用git时出现:warning: LF will be replaced by CRLF
- 1 springboot整合elasticsearch入门例子
- OPENGL—中点Bresenham画直线
- MySQL主从复制(七)
- 快速排序
- kotlin汇总8-其他1
- vs2015使用外部工具改变行尾CRLF->LF
- gp5.0.0源码安装部署3节点
- Maven_Spring_Mybatis 实例
- http://blog.csdn.net/lmj623565791/article/details/72667669
- 基于Spark Mllib,SparkSQL的电影推荐系统
- LeetCode 第三题,官方给的标准答案的一个分析,利用空间换时间,将复杂度降到了O(n)
- inux 日志切割工具cronolog配置步骤
- PR菜鸟入门 -- PR下载安装
- 词根词缀