fprintf中 [英] fprintf
问题描述
大家好,
我想写下以下一行:
mtext(1,at = Graph,text = sprintf( ''%0.2f'',MP $ LR),line = 1)
在一个文件中(例如:Hist.R),函数如下:
void Graph()
{
FILE * RH = fopen(" Hist.R"," w");
..
..
..
fprintf(RH," mtext(1,at = Graph, text = sprintf(''%0.2f'',MP $ LR),
line = 1)\ n");
..
..
..
fclose(右);
当我运行程序时,程序写入的是什么''Hist.R''文件
是:
mtext(1,at = Graph,text = sprintf(''0.00'',MP $ LR),行= 1)
它是''0.00''而不是''%0.2f''。有人可以帮我解决这个问题吗?
谢谢,
Mohsen
LR),line = 1)
在一个函数中的文件(例如:Hist.R)如下:
void Graph()
{
FILE * RH = fopen(" Hist.R"," w" ;);
..
..
..
fprintf(RH," mtext(1 ,at = Graph,text = sprintf(''%0.2f'',MP
LR),
line = 1)\ n");
..
..
..
fclose(RH);
>
当我运行程序时,在''Hist.R''文件中写入的程序
是:
mtext(1, at = Graph,text = sprintf(''0.00'',MP
LR),line = 1)
它是''0.00 ''而不是''%0.2f''。有人可以帮我解决这个问题吗?
谢谢,
Mohsen
Hello all,
I want to write the following line:
mtext(1, at=Graph, text=sprintf(''%0.2f'',MP$LR), line=1)
in a file (for example:Hist.R) in a function as follow:
void Graph()
{
FILE *RH=fopen("Hist.R","w");
..
..
..
fprintf(RH,"mtext(1, at=Graph, text=sprintf(''%0.2f'',MP$LR),
line=1)\n");
..
..
..
fclose(RH);
When I run the program, what program writes in the ''Hist.R'' file
is:
mtext(1, at=Graph, text=sprintf(''0.00'',MP$LR), line=1)
it is ''0.00'' instead of ''%0.2f''. Can anybody help me to solve
this problem?
Thanks,
Mohsen
LR), line=1)
in a file (for example:Hist.R) in a function as follow:
void Graph()
{
FILE *RH=fopen("Hist.R","w");
..
..
..
fprintf(RH,"mtext(1, at=Graph, text=sprintf(''%0.2f'',MP
LR),
line=1)\n");
..
..
..
fclose(RH);
When I run the program, what program writes in the ''Hist.R'' file
is:
mtext(1, at=Graph, text=sprintf(''0.00'',MP
LR), line=1)
it is ''0.00'' instead of ''%0.2f''. Can anybody help me to solve
this problem?
Thanks,
Mohsen
这篇关于fprintf中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!