This:
201 205 203 205 203 205 203 205 203 205 203 205 203 205 203 205 187
186 177 186 224 186 177 186 224 186 177 186 224 186 177 186 224 186
204 205 206 205 206 205 206 205 206 205 206 205 206 205 206 205 185
186 224 186 177 186 224 186 177 186 224 186 177 186 224 186 177 186
204 205 206 205 206 205 206 205 206 205 206 205 206 205 206 205 185
186 177 186 224 186 177 186 224 186 177 186 224 186 177 186 224 186
204 205 206 205 206 205 206 205 206 205 206 205 206 205 206 205 185
186 32 186 177 186 32 186 177 186 32 186 177 186 32 186 177 186
204 205 206 205 206 205 206 205 206 205 206 205 206 205 206 205 185
186 177 186 32 186 177 186 32 186 177 186 32 186 177 186 32 186
204 205 206 205 206 205 206 205 206 205 206 205 206 205 206 205 185
186 225 186 177 186 225 186 177 186 225 186 177 186 225 186 177 186
204 205 206 205 206 205 206 205 206 205 206 205 206 205 206 205 185
186 177 186 225 186 177 186 225 186 177 186 225 186 177 186 225 186
204 205 206 205 206 205 206 205 206 205 206 205 206 205 206 205 185
186 225 186 177 186 225 186 177 186 225 186 177 186 225 186 177 186
200 205 202 205 202 205 202 205 202 205 202 205 202 205 202 205 188
... with this:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
FILE *fp = NULL;
char buffer[4096];
char tmp[4] = {0,0,0,0};
int cnt = 0;
void convert(void)
{
int c;
if(cnt > 0){
c = atoi((char *)&tmp);
if(c > 0) printf("%c",c);
memset((void *)tmp,0,4);
cnt = 0;
}
return;
}
int main(int argc, char *argv[])
{
int i,c,n;
fp = fopen("cBoard.txt","rb");
if(fp == NULL){
printf("Could not open cBoard.txt");
return 1;
}
while(!feof(fp)){
n = fread(buffer,1,4096,fp);
if((n == 0) || ((n != 4096) && ferror(fp))) break;
for(i=0; i<n; i++)
{
c = buffer[i];
if((c >= 0x30) && (c <= 0x39)){
tmp[cnt] = c;
cnt++;
if(cnt > 3) convert();
}else{
convert();
if((c == 0x0D) || (c == 0x0A)){
printf("%c",c);
}
}
}
}
convert();
fclose(fp);
return 0;
}
... or this:
global _main
extern _atoi
extern _printf
extern _fopen
extern _fread
extern _fclose
extern _feof
extern _ferror
extern _exit
[section .data]
file_name DB 'cBoard.txt',0
file_mode DB 'rb',0
file_handle DD 0
error_open DB 'Could not open cBoard.txt',0
char DB '%c',0
cnt DD 0
[section .bss]
tmp RESD 1
buffer RESB 4096
[section .text]
_main:
push file_mode
push file_name
call _fopen
add esp,8
mov DWORD[file_handle],eax
test eax,eax
jnz .read
push error_open
call _printf
add esp,4
jmp exit
.read:
call read
jc .last
mov edi,eax
mov esi,buffer
cld
.parse:
lodsb
cmp al,0x30
jb .whitespace
cmp al,0x39
ja .whitespace
mov ebx,tmp
add ebx,DWORD[cnt]
mov BYTE[ebx],al
inc DWORD[cnt]
cmp DWORD[cnt],3
jb .next
xor eax,eax
.whitespace:
push eax
call convert
pop eax
cmp al,0x0D
je .print
.linefeed:
cmp al,0x0A
jne .next
.print:
call print
.next:
dec edi
jnz .parse
jmp .read
.last:
call convert
exit:
mov eax,DWORD[file_handle]
test eax,eax
jz .ret
push eax
call _fclose
add esp,4
.ret:
xor eax,eax
ret
convert:
push tmp
call _atoi
add esp,4
test eax,eax
je .ret
call print
.ret:
mov DWORD[tmp],0
mov DWORD[cnt],0
ret
read:
push DWORD[file_handle]
call _feof
add esp,4
test eax,eax
jz .read
.eof:
stc
ret
.read:
push DWORD[file_handle]
push 4096
push 1
push buffer
call _fread
add esp,16
test eax,eax
jz .eof
cmp eax,4096
je .ret
push eax
push DWORD[file_handle]
call _ferror
add esp,4
mov ecx,eax
pop eax
test ecx,ecx
jnz .eof
.ret:
clc
ret
print:
movzx eax,al
push eax
push char
call _printf
add esp,8
ret
... produces this: