yea that was a typo.
As for the second problem I have traced the assertion failure to here:
Code:
String ^read;
.....
read = gcnew String(connector.ReadFromPipe().c_str());
......
And here is ReadFromPipe():
Code:
string Pconnect::ReadFromPipe(){
DWORD dwRead;
string ret = "NULL";
CHAR chBuf[BUFSIZE];
// Close the write end of the pipe before reading from the
// read end of the pipe.
if (!CloseHandle(hChildStdoutWr))
std::cerr << "Closing handle failed.\n";
// Read output from the child process, and write to parent's STDOUT.
while(true){
DWORD dwAvail = 0;
//check if child process ended
if (!::PeekNamedPipe(hChildStdoutRd, NULL, 0, NULL, &dwAvail, NULL))
break;
//check if there was no data
if (!dwAvail)
break;
//read the file and break once the reading is complete
if(!ReadFile( hChildStdoutRd, chBuf, BUFSIZE, &dwRead, NULL) || dwRead == 0)
break;
}
//make sure there is data to put in the string
if(dwRead > 0)
ret = chBuf;
string::iterator it1;
string::iterator it2;
//parse out ANSI escapes
for(it1 = ret.begin(); it1 != ret.end(); ++it1){
if(*it1 == 0x1B){
for(it2 = it1; it2 != ret.end()-1; ++it2){
if(isalpha(*it2)){
ret.replace(it1, it2+1, "");
if(it1 != ret.begin())
--it1;
break;
}
}
}
}
return ret;
}
The assertion failure says the following:
Code:
Debug Assertion Failed!
Program: ...
File: isctype.c
Line: 56
Expression: (unsigned)(c + 1) <= 256
I understand what an assertion is but I cannot for the life of my think of why this would be causing one. Worst case scenario no data is read and it just returns the string NULL.