Hi,

So I have a huge array of structures, and when I run qsort to sort on a key, it zeros 
out my entire array!!!!  I have looked up every book I could find on C and I think 
this is okay....but the results tell all!
Here is some code:
/* ---------------------------------------------- */

/*  Data def.    */
typedef struct uu_rec
{
        char            username[50];
        int             bytesSent;
        int             bytesRecieved;
        char            trans_date[30];
} UU_Record; 
/* create the array     */
UU_Record       data_list[15000]; 


/* -----------------
* A bunch of code goes here 
* to fill data_list with data
*  -----------------*/


int my_strcmp(const void *a, const void *b)
{    return strcmp( ((UU_Record *)a)->username,((UU_Record*)b)->username); 
}


/*  Call the sort function  */
qsort(data_list, 15000, sizeof(UU_Record), my_strcmp);
  

/* ----------------
* Now Data List 
* is empty!!!  WHY??
* ----------------/*


/* ---------------------------------------------- */
Thanks in advanced,

Ryan



Reply via email to