Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2006-10-26 13:48:01


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<x, n>::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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net