Finishing strings in C ++ (or R)

I have C ++ that I run, although R (via Rcpp). I recently discovered that the C ++ program that I am wrapping with Rcpp fails when using Windows-style line endings.

I am wondering if anyone knows of a cross-platform way to change Windows-style line endings for Unix-style line endings in either C ++ or the R or ash shell (which installs with R).

Thank!

+5
source share
1 answer

Use the R function readLines, which is immune to various LEs and then passes the string vector to C ++. Or, if you don’t like changing part of C ++, use pasteto change LE to whatever you want.

+1

All Articles