Domanda

how can i give particular name to .gcda and .gcno files each time compile rather than the default name so that i can combine all results in lcov.

Suppose in following code.

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;
}

On compiling first time i want to generate test1.gcno and test1.gcda file and on again i want to generate test2.gcno and test.2gcda files if the name of the c file is saved as check.c

È stato utile?

Soluzione

If you're on Windows, you can use CopyFile(source, destination, FALSE); Checking the number of times you've compiled, just analyze how many files were copied by by CopyFile() with an open file function like fopen("test.txt", "r");. It return NULL if the file does not exist.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top