-1

如何在每次编译时为 .gcda 和 .gcno 文件指定特定名称而不是默认名称,以便我可以将所有结果合并到 lcov 中。

假设在下面的代码中。

enter code here
#include<stdio.h>
main()
{
    int n;
    printf("Enter an integer\n");
    scanf("%d",&n);

    if ( n%2 == 0 )
       printf("Even\n");
    else
       printf("Odd\n");

    return 0;
}

在第一次编译时,我想生成 test1.gcno 和 test1.gcda 文件,如果 c 文件的名称保存为 check.c,我想再次生成 test2.gcno 和 test.2gcda 文件

4

1 回答 1

1

如果你在 Windows 上,你可以使用CopyFile(source, destination, FALSE); Checking the number of times you've compiled,只需CopyFile()使用打开文件函数(如fopen("test.txt", "r");. 如果文件不存在,则返回 NULL。

于 2013-06-03T10:11:29.273 回答