Menu

Saving results in file failed

Elena
2018-03-19
2018-03-21
  • Elena

    Elena - 2018-03-19

    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.

     
  • versat

    versat - 2018-03-19

    If your Cppcheck version is not too old you can use the parameter --output-file
    From the help text:

    --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.

     
  • Elena

    Elena - 2018-03-21

    Dear versat,

    It worked for me. Thank you for your support.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.