streamlet-examples/streamlet-common.h
branchv_0
changeset 95 f2f2b81079a5
parent 75 ecbf6504915c
equal deleted inserted replaced
94:b26e9b224fbe 95:f2f2b81079a5
    73 		for (char ch; std::cin.read(&ch, 1).good() && ch != SEPARATOR;) s.put(ch);
    73 		for (char ch; std::cin.read(&ch, 1).good() && ch != SEPARATOR;) s.put(ch);
    74 		return convertor.from_bytes(s.str());
    74 		return convertor.from_bytes(s.str());
    75 	}
    75 	}
    76 
    76 
    77 	void writeString(std::wstring s) {
    77 	void writeString(std::wstring s) {
       
    78 		// if the value contains a null byte 0x00, it will be trimmed (passing 0x00 through would break the protocol)
    78 		std::cout << convertor.to_bytes(s.c_str());
    79 		std::cout << convertor.to_bytes(s.c_str());
    79 		std::cout.put(SEPARATOR);
    80 		std::cout.put(SEPARATOR);
    80 		if (std::cout.bad()) throw std::runtime_error("Unable to write to sub-process.");
    81 		if (std::cout.bad()) throw std::runtime_error("Unable to write to sub-process.");
    81 	}
    82 	}
    82 
    83