Victor said:
qazmlp said:
int main()
{
func() ; // No command line arguments are passed to func().
Nothing to pass. You used the form of 'main' without arguments. Even
if you did use 'main(int argc, char *argv[])' there is no guarantee that
argv[0] actually contains anything useful.
"3.6.1.2 An implementation shall not predefine the main function. This
function shall not be overloaded. It shall have a return type of type
int, but otherwise its type is implementation defined.
All implementations shall allow both of the following definitions of
main:int main() { /* ... */ }
and int main(int argc, char* argv[]) { /* ... */ }
In the latter form argc shall be the number of arguments passed to the
program from the environment in
which the program is run. If argc is nonzero these arguments shall be
supplied in argv[0] through
argv[argc1]
as pointers to the initial characters of null terminated
multibyte strings (NTMBSs)
(17.3.2.1.3.2) and argv[0] shall be the pointer to the initial character
of a NTMBS that represents the name used to invoke the program or "".
The value of argc shall be nonnegative. The value of argv[argc] shall be
0. [Note: it is recommended that any further (optional) parameters be
added after argv. ]"
Not a guarantee of being passed the name of the exe but does say (to me
at least)that it will be the exe name or empty. Slightly more useful
then a chocolate tea pot
Adrian