I have a C code, which creates a file file.txt and prints the hello world content in the file.
#include<stdio.h>
int main () {
FILE *fp;
char str[] = "Hello world";
fp = fopen( "file.txt" , "w" );
fwrite(str , 1 , sizeof(str) , fp );
fclose(fp);
return(0);
}
This binary is compiled in a static form My question is that, since I'm using a gem5 simulator in syscall emulation mode. I'm working on linux system.
In the hardware level, since we only know the instructions, for example if the binary has to open file.txt, how can I redirect it to open a different file (say hello.txt, i.e., for any filename specified, it should just trigger hello.txt). Any help would be appreciated.