472,782 Members | 1,274 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 software developers and data experts.

__FILE__ converstion to filename (without path)

How can I use the preprocessor functions to get the __FILE__ macro only with the filename (without the path).
The reason is that the objects are different when complied on different machines (althgouh the code has not changed).
any ideas? any alternatives will be fine as well.
Dec 23 '07 #1
1 4545
weaknessforcats
9,208 Expert Mod 8TB
The __FILE__ macro reports the path used by the preprocessor to open the file. Since you can have the same file name on different paths, it is important to know which one was used. The name you use in the #include is just the short name.
Dec 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Tom | last post by:
I'm trying to dynamically adjust the path for one of my scripts using this: $script_path = str_replace( $_SERVER, "", dirname(realpath(__FILE__)) ) . DIRECTORY_SEPARATOR; The problem: the...
9
by: qazmlp | last post by:
How exactly __FILE__ and __LINE__ macros are defined? Or, Is the definition of these macros implementation dependent ? I am wondering how easily they can get the file name and line number...
3
by: lauch2 | last post by:
VC7.1 changes the __FILE__. In vc6, the __FILE__ returns the . However, in vc7.1, the __FILE__ just returns the . It looks like vc7.1 changes a lot of things which makes it quite difficult to...
10
by: Brian Gruber | last post by:
Hi, I'm looking for a way to rename a whole directory of files in short order. The files in the directory have different lengths, however all of them end with _xxxx the x's represent a randomly...
2
by: fortepianissimo | last post by:
This is a question to all of you who use Komodo IDE for development: when I tried to debug my script which uses __file__ to get the absolute path to the file, Komodo complained that the variable is...
18
by: Lukas Ruf | last post by:
Dear all, for debugging purposes, I like the pre-compiler macros __FILE__, __FUNCTION__, __LINE__ I have been wondering if there is a short form of __FILE__ that provides only the filename...
0
by: snabakvinod | last post by:
Hi, In VC8 project release mode, using __FILE__ macro and compiler option /FC, I can get the full path name with all small letters(Ex: c:\testvc8project\samplefilename.cpp). But I could...
0
by: Vinod | last post by:
Hi, In VC8 project release mode, using __FILE__ macro and compiler option /FC, I can get the full path name with all small letters(Ex: c:\testvc8project\samplefilename.cpp). But I could not...
4
by: 7stud | last post by:
Hi, I'm having trouble understanding what the definition of __file__ is. With this program: ------ #data.py: def show(): print __file__
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.