Test get/getline/read/readsome configuration in std.cfg

This commit is contained in:
Daniel Marjamäki 2017-03-04 08:56:37 +01:00
parent 930aa3c5b2
commit a8424bcb54
1 changed files with 22 additions and 0 deletions

View File

@ -3221,3 +3221,25 @@ void stdalgorithm(const std::list<int> &ints1, const std::list<int> &ints2)
std::for_each(ints1.begin(), ints2.end(), [](int i) {}); std::for_each(ints1.begin(), ints2.end(), [](int i) {});
} }
void getline() {
// #837
std::ifstream in("test1.txt");
char cBuf[10];
// cppcheck-suppress bufferAccessOutOfBounds
in.getline(cBuf, 100);
// cppcheck-suppress bufferAccessOutOfBounds
in.read(cBuf, 100);
// cppcheck-suppress bufferAccessOutOfBounds
in.readsome(cBuf, 100);
// cppcheck-suppress bufferAccessOutOfBounds
in.get(cBuf, 100);
// cppcheck-suppress bufferAccessOutOfBounds
in.get(cBuf, 100, 'a');
// cppcheck-suppress bufferAccessOutOfBounds
in.getline(cBuf, 100, 'a');
in.close();
}