Commit 96acd1ee authored by Benoit Perrot's avatar Benoit Perrot
Browse files

Fix read_string.

parent 3e2940e5
2003-07-06 Benot Perrot <benoit@lrde.epita.fr>
* src/vm/virtual_machine.cc:
read_string stops after an OEF or a newline; if a newline is read,
it is stored into the buffer.
2003-07-05 Benot Perrot <benoit@lrde.epita.fr>
* dev/mipsy.xml,
......
......@@ -503,10 +503,11 @@ namespace vm
for (; i < cpu.get_a(1); ++i)
{
int c = std::cin.get();
// FIXME: check if read_string must end on end of line
if (c == '\n' || c == '\r' || std::cin.eof())
if (std::cin.eof())
break;
_memory.store_byte(cpu.get_a(0) + i, c);
if (c == '\n' || c == '\r')
break;
}
_memory.store_byte(cpu.get_a(0) + i, 0);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment