How can I get the location of the program I'm running? Any function?
How can I get the location of the program I'm running? Any function?
Location?
Boy, the questions sure have reached a new depth in vagueness.Code:if ( isRunningOnEarth() ) { // examine earth rock } else { // examine mars rock }
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
i didn't understand ur question.
I assume this may be the answer for the question
argv[0] parameter hold the fully qualified path name of the program ur running
> argv[0] parameter hold the fully qualified path name of the program ur running
Whilst it contains the program name (if available), there's no guarantee that it includes the whole path.
What you get depends on what you type, and what your CLI does with it.
And its "your" not "ur"Code:$ cat foo.c && gcc foo.c && ./a.out #include <stdio.h> int main ( int argc, char *argv[] ) { printf ( "%s\n", argv[0] ); return 0; } ./a.out
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
1.)What difference does it make?And its "your" not "ur"
2.)Why should one require the full path if one intends on using it directly as some kind argument? So please specify what u want to use it for?
> 1.)What difference does it make?
http://www.catb.org/~esr/faqs/smart-...html#writewell
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I agree in using proper English, but he was not the OP or the one asking the question. Your link is, "How To Ask Questions The Smart Way," not "How To Answer Questions The Smart Way."Originally Posted by Salem
Warning: Have doubt in anything I post.
GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101