'Passing values to command line from a function-C language
I am trying to find out how to pass output value of a function into command line in a C file. The name of the variable is "Cext", "Cabs". The default behavior of the program is to create a folder which contains C files in which the output is printed. The code where I have to edit is as follows:
In the lines 922-925,
CCfile=FOpenErr(fname,"w",ONE_POS);
PrintBoth(CCfile,"Cext\t= "GFORM"\nQext\t= "GFORM"\n",Cext,Cext*inv_G);
PrintBoth(CCfile,"Cabs\t= "GFORM"\nQabs\t= "GFORM"\n",Cabs,Cabs*inv_G);
FCloseErr(CCfile,F_CS,ONE_POS);
What changes I should make? So i can get the value on the command line and than store it in an array. Any links/ text to read or sample code would be highly appreciated? I have previously looked at these links but i still haven' figured it out
Solution 1:[1]
strncpy(fname_cs,"dev/null",400)
had to write this line of code multiple times in the c file, so nothing is printed and than in the shell, i transferred the data to a variable before it is deleted.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Hamzah Khan |