I have a text.txt
file and I want to read it and print its content in the Output Window of IDA Pro (Free version).
I wrote an .idc script as follows:
#include <idc.idc>
static main() {
auto fp;
auto toPrint;
fp = fopen("C:\Users\bob\text.txt", "r"); // fp is a file handle
toPrint = fgetc(fp);
Message("%s is the string\n", toPrint);
}
But it gives me an unknown character
as shown above. I also tried using toPrint = readstr(fp)
, but it does not work. (same unknown character)
PS: I'm analysing a 32 bit PE file. I could not use IDAPython, as I'm using the x64 free version, so I have to resort to IDC. Any help appreciated.