I am trying to port a C++ program from Windows to Ubuntu . In Ubuntu environment , My program reads a text file which was created in Windows , however it appears the Carriage Return is affecting the reading of the file in Ubuntu environment , therefore I wish to remove all the Carriage Return .
I have tried the following command on Windows to convert the text file to Linux format
dos2unix User.txt User1.txtI also tried this
tr -d '\15\32' < User.txt > User1.txtBoth these methods dont work , I am getting the following error :
is not recognised as an internal or external command , op program , or batch fileWhat am I doing wrong here ??
21 Answer
I have tried the following command on Windows to convert the text file to Linux format
Try to run the commands on your Ubuntu machine. tr is in coreutils and therefore always available, dos2unix needs to be installed.
As a side note: In Python, a file object has the attribute newlines, that stores all end-of-line characters in a tuple. Is something similar available for C++?
0