Browse Source

Updated clostStdin test to use cin.eof() and cin.read().


git-svn-id: https://svn.microneil.com/svn/CodeDweller-Tests/trunk@60 b3372362-9eaa-4a85-aa2b-6faa1ab7c995
master
adeniz 8 years ago
parent
commit
277520771c
1 changed files with 13 additions and 7 deletions
  1. 13
    7
      TestChild/childProgram.cpp

+ 13
- 7
TestChild/childProgram.cpp View File

#include <fstream> // debug #include <fstream> // debug
#endif #endif
#include <string> #include <string>
#include <vector>
#include <thread> #include <thread>
#include <chrono> #include <chrono>
<< std::endl; << std::endl;
#endif #endif
std::string temp;
int const BufferSize = 512;
std::cin >> temp;
std::vector<char> readBuffer;
readBuffer.resize(BufferSize, 0);
std::cin.read(&(readBuffer[0]), BufferSize);
if (!std::cin.eof()) {
if (std::cin.eof()) {
#ifdef DEBUG_MESSAGES #ifdef DEBUG_MESSAGES
log << "stdin was closed." << std::endl;
log << "stdin was not closed." << std::endl;
#endif #endif
returnStatus = 15; // Successful return.
returnStatus = 10; // Unsuccessful return.
} else { } else {
#ifdef DEBUG_MESSAGES #ifdef DEBUG_MESSAGES
log << "stdin was not closed." << std::endl;
log << "stdin was closed." << std::endl;
#endif #endif
returnStatus = 10; // Unsuccessful return.
returnStatus = 15; // Successful return.
} }
goto exit; goto exit;

Loading…
Cancel
Save