您好,
我有下面的代码片段:
我应该看到我的文件只有10线,但我有几百行
#include "TimeUtils.hpp"
FILE *output; // internal filename
int main(int argc, char *argv[])
{
//?
//More code
//?
time01 = time_now(); // Returns the time now
while(1)
{
time02 = time_now(); // Returns the time now
static long count = 0;
count = (time02-time01)/1000; // Number of seconds since time01?
Rangek.runge4(count, y, dist); // Method executed in real time [Is this the way to do this?]
/*
My problem:
I want to print to file output?only once per second.
How do I do that?
*/
if((count%2) != 0)
{
fprintf(output, "%f\t%f\n", count, y[0]);
continue;
}
cout << "Counting: " << count << " seconds\n";
if( ((time02-time01)/1000) >= 10) break; // Stop after 10 second
}
fclose(output);
return 0;
}
我,我可以使它每秒打印一次?
感谢你的帮助。
的问候,
埃尔韦| hervebags