I am forced to use memset and drand48() to set a random number (2 - 7) of random characters that are lower case letters ('a' to 'z'). My code returns non ASCII characters and I am not sure why.
struct Record {
int seqnum;
float threat;
unsigned int addrs[2];
unsigned short int ports[2];
char dns_name[NUMLTRS];
};
My code is in a for loop:
memset(rec_ptr[i].dns_name, (char)((122 * drand48()) + 97),
((sizeof(char) * 7) * drand48()) + (sizeof(char) * 2));
Aucun commentaire:
Enregistrer un commentaire