重定向到STDOUT问题 [英] Redirect to STDOUT Problem
问题描述
尝试做一些相当常规的事情......将输出丢弃到文件中
图,但是bash命令行中的以下命令:
ising output
产生一个闪烁的光标,一个名为output的空文件,和一个永远运行的
程序。没有重定向,输出正常。
下面是用于生成输出的printf语句。
printf(" B =%4.2f E = %8.4fm =%8.4f Cv =%5.2f \
Chi =%5.2f \ n",beta,(energy / n2),(moment / n2),\
(summe2-summe * summe)/ n2,\
(summm2-summm * summm)/ n2);
我验证像''ls output''这样的东西工作得很好,而且我可以
也重定向我写的其他c程序的输出。对于这一个有点儿好笑。
有什么想法吗?
Trying to do something fairly routine... drop output into a file to
graph, but the following command at the bash command line:
ising output
produces a blinking cursor, an empty file named "output," and a
program that runs forever. With no redirect, the output is normal.
Below is the printf statement used to generate output.
printf("B=%4.2f E=%8.4f m=%8.4f Cv=%5.2f \
Chi=%5.2f\n",beta,(energy/n2),(moment/n2), \
(summe2-summe*summe)/n2, \
(summm2-summm*summm)/n2);
I verified that things like ''ls output'' work fine, and that I can
also redirect output from other c programs I''ve written. Something is
funny about this one.
Any thoughts?
推荐答案
Jordan Glassman< jo ************ @ gmail.comwrites:
Jordan Glassman <jo************@gmail.comwrites:
尝试做一些相当常规的事情。 ..将输出丢弃到文件中,然后在bash命令行中输出以下命令:
输出
Trying to do something fairly routine... drop output into a file to
graph, but the following command at the bash command line:
ising output
在现代系统上,。往往不在你的道路上。您是否忘记了输入./ising的
?
On modern systems, . is often not in your path. Did you just forget
to type ./ising?
产生一个闪烁的光标,一个名为output的空文件,和一个永远运行的
程序。没有重定向,输出正常。
下面是用于生成输出的printf语句。
printf(" B =%4.2f E = %8.4fm =%8.4f Cv =%5.2f \
Chi =%5.2f \ n",beta,(energy / n2),(moment / n2),\
(summe2-summe * summe)/ n2,\
(summm2-summm * summm)/ n2);
produces a blinking cursor, an empty file named "output," and a
program that runs forever. With no redirect, the output is normal.
Below is the printf statement used to generate output.
printf("B=%4.2f E=%8.4f m=%8.4f Cv=%5.2f \
Chi=%5.2f\n",beta,(energy/n2),(moment/n2), \
(summe2-summe*summe)/n2, \
(summm2-summm*summm)/n2);
这里没有什么可以解释发生了什么。 printf是正确的。
当然,如果n2 == 0你不会得到任何输出但是会发生
有和没有重定向。
Nothing here can explain what is happening. The printf is correct.
Of course, if n2 == 0 you won''t get any output but that will happen
with and without the redirect.
我确认像''ls output''这样的东西工作正常,而我可以
也重定向来自其他c程序的输出我已经书面。这个有点儿好笑。
有什么想法吗?
I verified that things like ''ls output'' work fine, and that I can
also redirect output from other c programs I''ve written. Something is
funny about this one.
Any thoughts?
问题可能不在C代码中。你需要有人看你正在做的事情,他们很可能会立即发现它。我想b / b
认为像comp.unix.programmer这样的团队可能会更好。
-
Ben。
The problem is probably not in the C code. You need someone to watch
exactly what you are doing and they''ll probably spot it in no time. I
think a group like comp.unix.programmer might be better.
--
Ben.
Ben,
感谢您的回复......
Ben,
Thanks for the reply...
现代系统。往往不在你的道路上。你有没有忘记输入./ising的
?
On modern systems, . is often not in your path. Did you just forget
to type ./ising?
不,这不是问题。
No, that''s not the problem.
这里没有什么可以解释发生了什么。 printf是正确的。
当然,如果n2 == 0你不会得到任何输出但是会发生
有和没有重定向。
问题可能不在C代码中。你需要有人看你正在做的事情,他们很可能会立即发现它。我认为像comp.unix.programmer这样的团队可能会更好。
Nothing here can explain what is happening. The printf is correct.
Of course, if n2 == 0 you won''t get any output but that will happen
with and without the redirect.
The problem is probably not in the C code. You need someone to watch
exactly what you are doing and they''ll probably spot it in no time. I
think a group like comp.unix.programmer might be better.
我倾向于同意,但因为*其他所有*除了这个
特定的c程序,其中只包含几个<内部循环和这一个输出语句的
计算,我决定先在这里发布
。
-j
I tend to agree, but since *everything else* works except this
particular c program, which contains nothing more than a few
calculations inside loops and this one output statement, I decided to
post here first.
-j
Jordan Glassman写道:
Jordan Glassman wrote:
...
我倾向于同意,但是因为*一切else *作品除了这个
特定的c程序,其中只包含几个
计算内部循环和这一个输出语句,我
决定先在这里发帖。
...
I tend to agree, but since *everything else* works except this
particular c program, which contains nothing more than a few
calculations inside loops and this one output statement, I
decided to post here first.
虽然由于某种原因你决定不发布代码。
仍然,你的损失......
>
-
彼得
Though for some reason you decided not to post the code.
Still, your loss...
--
Peter
这篇关于重定向到STDOUT问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!