stdio performance in tango, stdlib, and perl

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Thu Mar 22 10:59:37 PDT 2007


Roberto Mariottini wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
> [...]
>>
>> #include <string>
>> #include <iostream>
>>
>> int main() {
>>   std::string s;
>>   while (getline(std::cin, s)) {
>>     std::cout << s << '\n';
>>   }
>> }
> 
> The portable way to write a newline in C++ is to use the 'endl'
> modifier.
> Your program is not portable, on Windows it will generate Unix text files.

Wrong. Newline translation will be correct on both systems.

Andrei



More information about the Digitalmars-d mailing list