Is there a way to detect or change the EOL format from windows to linux in C++? -


my application cannot read windows format eol files, there's way can detect format of files? or change eol linux format? able display error message if format not linux. know windows format eol crlf , linux lf.

just:

  • open file in binary mode
  • find first '\n' byte
  • check if byte before found 1 equals '\r'

if ask if there such functionality in standard library, answer - there isn't.


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -