Glam Prestige Journal

Bright entertainment trends with youth appeal.

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.txt

I also tried this

 tr -d '\15\32' < User.txt > User1.txt

Both these methods dont work , I am getting the following error :

is not recognised as an internal or external command , op program , or batch file

What am I doing wrong here ??

2

1 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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy