Commit f73542e3 authored by Benoit Perrot's avatar Benoit Perrot
Browse files

Really fix read_string.

parent 96acd1ee
......@@ -500,14 +500,13 @@ namespace vm
case 8:
{
int i = 0;
for (; i < cpu.get_a(1); ++i)
int c = 0;
for (; (i < cpu.get_a(1) - 1) && (c != '\n') && (c != '\r') ; ++i)
{
int c = std::cin.get();
c = std::cin.get();
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);
}
......
Markdown is supported
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