Can anyone tell me why this programm causes an ilegal operation please.
Code:int main( int argc, char *argv )
{
puts(getcwd( argv, argv[1] ));
getch( );
return 0;
}
Printable View
Can anyone tell me why this programm causes an ilegal operation please.
Code:int main( int argc, char *argv )
{
puts(getcwd( argv, argv[1] ));
getch( );
return 0;
}
For starters, that's wrong. It should be:Code:int main( int argc, char *argv )
Next, you probably shouldn't be trying to modify argv. Make your own buffer, and use it instead.Code:int main( int argc, char *argv[] )
Quzah.
sorry im new to c.. when you say make your own buffer you mean as in,
or should i copy argv[1] to buff[80]?Code:char buff[80];
been learning for a few days day & nite so forgive for my lack knowledge
sorry i got it.. i should of just tried it instead of posting. thank you again