我正在尝试找出如何将函数的输出值传递到C文件中的命令行。该变量的名称是“ cext”,“ cabs”。程序的默认行为是创建一个文件夹,其中包含打印输出的C文件。我必须编辑的代码如下:
在第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);
我应该做什么变化?因此,我可以在命令行上获得值,而不是将其存储在数组中。对阅读或示例代码的任何链接/文本都将不胜感激吗?我以前曾查看过这些链接,但我仍然尚未将其弄清楚
- Pass从命令行进入C程序的参数
- cragments> in Main to c
- https://www.geeksforgeekss.org/command-line-arguments-inguments-inguments-in -c-cpp/
-
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
- Pass arguments into C program from command line
- Arguments to main in C
- https://www.geeksforgeeks.org/command-line-arguments-in-c-cpp/
- https://techvidvan.com/tutorials/command-line-arguments-in-c/
发布评论
评论(1)
必须在c文件中多次编写这条代码行,因此没有打印任何印刷,而是在shell中,我将数据传输到变量之前,然后将其删除。
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.