开发者

Flipping line endings in C++ (or R)

开发者 https://www.devze.com 2023-01-08 01:44 出处:网络
I have a C++ that I\'m running though R (via Rcpp).Recently, I found that the C++ program I\'m wrapping with Rcpp fails when using Windows-style line endings.

I have a C++ that I'm running though R (via Rcpp). Recently, I found that the C++ program I'm wrapping with Rcpp fails when using Windows-style line endings.

I'm wond开发者_StackOverflow中文版ering if anyone knows of a cross-platform way for me to change Windows-style line endings to Unix-style line endings in either C++ or R or ash shell (which comes installed with R).

Thanks!


Use R function readLines, which is immune to various LEs, and then pass string vector to C++. Or, if you don't like to change the C++ part, use paste to change the LEs to whatever you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消