4 #include <cstdlib> // for EXIT_FAILURE
10 #include <simgear/misc/sgstream.hxx>
14 const char* fileName = "testfile";
17 f.open(fileName, std::ios::binary | std::ios::trunc | std::ios::out);
18 f.write("first line ends with line-feed\n"
19 "second line ends with just a cr\r"
20 "third line ends with both\r\n"
21 "fourth line as well\r\n"
22 "fifth line is another CR/LF line\r\n"
23 "end of test\r\n", 1024);
27 sg_gzifstream sg(fileName);
31 if (stuff != "second") return EXIT_FAILURE;
32 cout << "Detection of LF works." << endl;
36 if (stuff != "third") return EXIT_FAILURE;
37 cout << "Detection of CR works." << endl;
41 if (stuff != "fourth") return EXIT_FAILURE;
42 cout << "Detection of CR/LF works." << endl;
47 if (stuff != "end") return EXIT_FAILURE;
48 cout << "Detection of 2 following CR/LF lines works." << endl;