Stupid question. Haven't done production C in a while and just inherited some legacy code. In case it makes a difference it is running out of OMVS on a Z/OS IBM mainframe. The C program is invoked by an assembler program. The assembler program passes in a number arguments that are simply addresses. Some are addresses that contain addresses, and some are just addresses.
The C program then uses strcpy and memcpy to move data back and forth between the assembler program and the C program. I'm at the point where I'm trying to save some space. Currently I am copying the passed addresses to a pointer variable, and then using that variable in strcpy. For example
char *cTempPtr = NULL, search[256] = "init";
cTempPtr = argv[1];
strcpy(search, cTempPtr);
What I would like to do is cut out the need for the extra pointer variable and just dereference the address contained in argv[1]. I have tried numerous combinations of *argv[1], etc... but apparently I just don't remember by reference/dereference logic well enough. I also haven't found any useful hits on google. To clarify I would like the code to look like:
char *cTempPtr = NULL, search[256] = "init";
strcpy(search, *argv[1]);
That is the basic idea anyway. Basically, the value of argv[1] is an address that points to the first byte of a null terminated character array that has been allocated in the assembler program. So, I want strcpy to use the address in argv[1] to copy that value, without having to use a middleman in the form of a pointer variable. But all my attempts to dereference argv[1] have failed. Any help will be appreciated.