30 Oct
2006
30 Oct
'06
09:36
On Mon, Oct 30, 2006 at 01:24:35AM -0800, appy 80 wrote:
Hi,
The following program crashes on suse-ppc. I am trying to copy the command line parameters to a string buffer. I tried this on suse i386 and its working fine. Its crashing on suse-ppc.
#include
#include main(int argc, char *argv[]) { char Buffer[1024]; va_list ap; //ap = argv; //works fine on i386 va_copy(ap,argv); // cant use ap = argv on ppc. Need to use va_copy vsprintf(Buffer,"Command Line arguments: %s\n",ap); printf("%s", Buffer); }
Please help me in resolving this.
The argv array is not a variable argument list.
You will have to use a for(i=1;i