what happens if you replace your "// os = std::ostream& object" with say, std::cerr? same code snippet for me, doesn't strip any white space:

for(int i = 0, s = args.Length(); i < s; ++i) {
  v8::String::AsciiValue ascii(args[i]);
  std::cerr.write(*ascii, ascii.length()) << std::endl;
}

On 05/01/12 17:47, idleman wrote:
Why does all white spaces get removed in the example below?

//C++
Handle<Value> System::log(const Arguments& args)
{
for(int i = 0, s = args.Length(); i < s; ++i) {
String::AsciiValue ascii(args[i]);
os.write(*ascii, ascii.length()) << std::endl; //os = std::ostream& object
}
return Undefined();
}

//Then in javascript, there the System object have been "exposed" to
JavaScript.
System.log("How are you?"); //prints "howareyou?" not "how are you?",
e.g no whitespaces

In the example do I get the text: "Howareyou?", not "How are you?", what
does I wrong? Why are all white spaces removed? The std::ostream::write
write oformatted output, so it does not remove any white space, so it is
not the problem.

Thanks in advance!

--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to