Dear developer,
I used a simple example to test usage of cppcheck:
int main() { char a[10]; a[10] = 0; return 0; }
and want to save result in err.txt. The command line is:
cppcheck simple.c 2> ! err.txt
However, my err.txt is just have a line
Checking simple.c ...
and error display on commander
[simple.c:4]: (error) Array 'a[10]' accessed at index 10, which is out of bounds.
Can you tell me why it occurs? Is it because of installation or another problem? I used lastest version of cppcheck.
Thank you very much.
If your Cppcheck version is not too old you can use the parameter --output-file From the help text:
--output-file
--output-file=<file> Write results to file, rather than standard error.
In Windows batch files something like
cppcheck simple.c 2> err.txt
worked for me before the --output-file parameter was introduced and i switched to that. Hope that helps.
Dear versat,
It worked for me. Thank you for your support.
Log in to post a comment.
Dear developer,
I used a simple example to test usage of cppcheck:
and want to save result in err.txt.
The command line is:
cppcheck simple.c 2> ! err.txt
However, my err.txt is just have a line
and error display on commander
Can you tell me why it occurs? Is it because of installation or another problem?
I used lastest version of cppcheck.
Thank you very much.
If your Cppcheck version is not too old you can use the parameter
--output-file
From the help text:
In Windows batch files something like
worked for me before the
--output-file
parameter was introduced and i switched to that.Hope that helps.
Dear versat,
It worked for me. Thank you for your support.