i need to generate a random number without using "random" function so i found this code which give me mlliseconds in system:
#include <stdio.h>
#include <sys/timeb.h>
int main()
{
struct timeb tmb;
ftime(&tmb);
printf("tmb.time = %ld (seconds)\n", tmb.time);
printf("tmb.millitm = %d (mlliseconds)\n", tmb.millitm);
return 0;
}
it was working good until i tried to use it inside struct in this way :
#include <sys/timeb.h>
#include "stdlib.h"
struct Num{
struct timeb tmb;
ftime(&tmp);
};
int main()
{
return 0;
}
its giving an error at {ftime}. any help ?
Aucun commentaire:
Enregistrer un commentaire