Your problem is probably that you are expecting them to be in the text file as text, but you're not converting them. Text is only useful if it is necessary that people should be able to read and modify it by hand. If you are sure you want them as text, then you can use this (Attention! Windows-based code):
Code:
char* buffer=(char*)HeapAlloc(GetProcessHeap());
if(buffer){
DWORD written;
sprintf(buffer,"%d %d",pe_cnt[current],pe_base);
HANDLE file=CreateFile("data.txt",GENERIC_WRITE,7,0,0,CREATE_ALWAYS,0,0);
if(file!=INVALID_HANDLE_VALUE){
WriteFile(file,buffer,strlen(buffer),&written,0);
CloseHandle(file);
}
HeapFree(GetProcessHeap(),0,buffer);
}
CRT code:
Code:
FILE file=fopen("data.txt","w");
if(file){
fprintf(file,"%d %d",pe_cnt[current],pe_base);
fclose(file);
}