Hello,
__FILE__ is a macro for the path to the current source file. I would like to remove the common prefix (like "c:\dev\my_program\") from it, which is in a preprocessor macro SOLUTIONDIR. Is there a metaprogramming way to do that?
So the class TSuffix should be used like this:
TSuffix
The first thing is, that you have to use a constant with external linkage, otherwise you can not pass the string as argument. extern const char* fname = __FILE__; Afeterwards you need to cut the end ;) what is a more difficult task. Read through the MPL algorithms. But another question: If you do it like mentions. You path will become incorrect, if executable is moved, since it will be calculated at compile time. With Kind Regards, Ovanes Markarian On Thu, October 26, 2006 08:44, Arno Schödl wrote:
Hello,
__FILE__ is a macro for the path to the current source file. I would like to remove the common prefix (like "c:\dev\my_program\") from it, which is in a preprocessor macro SOLUTIONDIR. Is there a metaprogramming way to do that?
So the class TSuffix should be used like this:
TSuffix
::value // cuts prefix of length n off char array x It would be nice if the compiler would not even store the whole path in the executable, but only the distinguishing suffix. Any ideas how to start?
TIA,
Arno _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Arno Schödl
-
Ovanes Markarian