How can I use a variable in my system function? I want to pass the system time into a bacth file I'm calling from the program.
Thanks
Sarah
How can I use a variable in my system function? I want to pass the system time into a bacth file I'm calling from the program.
Thanks
Sarah
You need to take the variable and place it in a string that contains the system call you wish to use. For example, if you want to open a user defined file in a program defined directory, you would paste the user defined string onto the program defined string:
strcat ( progDefined, userDefined );
Or you could use sprintf to fill a buffer and then use that buffer to make the system call:
sprintf ( buffer, "%s%s", progDefined, userDefined );
system ( buffer );
Take a look at the sprintf function for further details.
-Prelude
My best code is written with the delete key.