I am trying to write a program that imitates the functions of the C preprocessor.
So my question is about expanding #include "header.h"
statements.
I have a FILE *
pointer to the source file, so I need to scan for all the header files included in the source file, and for each one, enter to the header file and copy its content to a new file, and than copy the original source file to the new file, which will result in an expanded header files program.
My problem: reaching to the actual header files by scanning the source file (this is just for headers I have written, so they should be looked for in the folder where the source file is).
Any ideas would be appreciated. (I haven't posted my miserable attempts, but if it will help somehow, I will post them).