user defined path for FILENAME
When I need to use a data file I'll put it in the preprocessor directives:
#include FILENAME "c:\datafile.dat"
Is there a way of assigning FILENAME to some user defined file name? In other words, I would like to:
printf ("Enter the path of your data file =>");
and somehow associate this entry with FILENAME. I've tried playing around with some string subroutines and I can't figure out how to associate a string to a preprocessor directive (if that's even possible).
TIA for your response,
drdigimon
Re: user defined path for FILENAME
Quote:
Originally posted by drdigimon
When I need to use a data file I'll put it in the preprocessor directives:
#include FILENAME "c:\datafile.dat"
Is there a way of assigning FILENAME to some user defined file name? In other words, I would like to:
printf ("Enter the path of your data file =>");
and somehow associate this entry with FILENAME. I've tried playing around with some string subroutines and I can't figure out how to associate a string to a preprocessor directive (if that's even possible).
TIA for your response,
drdigimon
Note the term you used: preprocessor directive . That specifically means "before compiling the program." Therefore the program would already be built using whatever include files are specified.
You may need to simply read the data from the specified file as the program starts.