Ok.
I found the problem and corrected.
The first problem was because i wasn't in graphics mode, and KEY_ESCAPE didn't worked for this reason.
The second was simply corrected doing while not eof(stream).
I found the problem and corrected.
The first problem was because i wasn't in graphics mode, and KEY_ESCAPE didn't worked for this reason.
The second was simply corrected doing while not eof(stream).