GCC 7.3.0 -std=gnu++17 failed to getline() from std::ifstream
Ross Smith
ross.smith@otoy.com
Tue Jun 12 08:48:00 GMT 2018
On 2018年06月12日 02:17, Marco Atzeri wrote:
> On 6/11/2018 4:11 AM, Ross Smith wrote:
>> On 2018年06月06日 09:00, Marco Atzeri wrote:
>>> On 6/5/2018 10:32 PM, Ivan Shynkarenka wrote:
>>>> Â Hello
>>>>>>>> I use x64 bit Cygwin and it failed in my home, work and Appveyor. I
>>>> add
>>>> cygcheck.out with my environment.
>>>>>>>> I'm sorry about misspell prefix space in my prev example. Please try
>>>> the
>>>> following one:
>>>>>>>> #include <fstream>
>>>> #include <iostream>
>>>>>>>> int main(int argc, char** argv)
>>>> {
>>>> Â Â Â Â std::string line;
>>>> Â Â Â Â std::ifstream stream("test.cpp");
>>>> Â Â Â Â while (getline(stream, line))
>>>> Â Â Â Â Â Â Â Â std::cout << line << std::endl;
>>>> Â Â Â Â return 0;
>>>> }
>>>>>>>> g++ -std=gnu++17 test.cpp
>>>>>> works fine on 32 bit and 64 bit on my W7
>>>> I'm having the same problem. My test program:
>>>> #include <fstream>
>> #include <iostream>
>> int main() {
>> Â Â Â Â std::ifstream in("demo.cpp");
>>> with this change does not segfault
>> Â std::ifstream stream("demo.cpp\n");
It doesn't segfault because it doesn't open the file, because no file
named "demo.cpp\n" exists. I don't know WTF you thought you were doing
here.
Ross Smith
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list