Search code examples
pythonterminationlinefeed

different types of line terminations(unix, windows, etc)


I'm note sure about conventions for different types of line termination in different programming languages. I know that there are 2 types, 1: line feed, 2: carriage-return, line feed. My question is: how does readline in different programming languages, like python: a = fd.readline();, c/c++: file.getline (buffer,100);, java: line = buf.readLine(); deal with line termination? If they are sensitive to these 2 different types of terminations, how do I treat them separately?


Solution

  • You mostly don't need to worry about it. If you come to a point when something doesn't work, come back and ask about that.

    Note however that what determines the line-ending convention is not which programming language you use, but the platform it runs on (*nix/Windows/Mac, all are different).