I am using following C++ stl construct to read the file into vector of characters
std::ifstream testFile(inFileName, std::ios::binary);
std::vector<char> fileContents((std::istreambuf_iterator<char>(testFile)), std::istreambuf_iterator<char>());
But this also read \r\n into the vector.
Is there any way to avoid reading \r\n or delete after reading
Assuming you input file is generated on the same platform as you are reading it on.
Then you can convert the LTS (in this case it looks like ‘\r\n’) to a ‘\n’ simply by opening the file in text mode:
You can remove specific characters by using the
remove_copyalgorithm:If you need to remove more than one type of character you need to create a functor and use
remove_copy_ifalgorithm: