javascript - Message is not sent to Chrome extension -
i can read messages come extension, not able send message c++ native app chrome extension. using win 8 64bit. chrome log not report error, no info there.
here code:
void sendmessage(string msg){ _setmode(_fileno(stdout), _o_binary); unsigned int len = msg.length(); cout.write((char*)&len,4); //cout.write(reinterpret_cast<char*>(&len),4); std::cout << msg << flush; } string readmessage(){ string msg = ""; std::cout.setf( std::ios_base::unitbuf ); unsigned int ch;//, len = 0; //another way length _uint32t len = 0; cin.read(reinterpret_cast<char*>(&len) ,4); // read len number of characters message (int i=0; < len; i++) { ch = getchar(); msg += ch; } return msg; } int _tmain(int argc, _tchar* argv[]) { //reading messages extension string msg = readmessage(); //here write msg log , it's there. //sending message sendmessage ("sent c++"); return 0; }
what's wrong code? have tried many combinations writing message. also, have tried or without _setmode function, still not working.
thanks help.
Comments
Post a Comment