mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 19:03:33 +08:00
Matrix: capture stdout for print() test
I want to switch the print() function back to use printf() such that it's fully compatible with all (embedded) platforms. To still test the print function I'm capturing stdout into a file such that the print() function can stay unchanged and the result of the printf()s can be evaluated.
This commit is contained in:
committed by
Julian Kent
parent
c6db357c92
commit
a32892926c
+2
-2
@@ -350,13 +350,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void print(FILE *stream = stdout) const
|
||||
void print() const
|
||||
{
|
||||
// element: tab, point, 8 digits, 4 scientific notation chars; row: newline; string: \0 end
|
||||
static const size_t n = 15*N*M + M + 1;
|
||||
char * buf = new char[n];
|
||||
write_string(buf, n);
|
||||
fprintf(stream, "%s\n", buf);
|
||||
printf("%s\n", buf);
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user