Skip to content

Instantly share code, notes, and snippets.

@yuikns
Created May 14, 2013 12:56
Show Gist options
  • Save yuikns/5575647 to your computer and use it in GitHub Desktop.
Save yuikns/5575647 to your computer and use it in GitHub Desktop.
void storeIntoCSV(hashmap *phmap)
{
pNode np;
int plen;
int i;
int j;
unsigned long count;
pAlist ap = getAuthorList();
FILE *fp;
if((fp = fopen("CoAuthor.csv","w")) == NULL)
{
fprintf(stderr,"error opening CoAuthor.csv\n");
}
count = hashmapCount(phmap);
printf(" count:%ld\n",count);
for(j=0;j<count && ap != NULL;j++)
{
printf("%d:%ld ",j,ap->aid);
if((np=hashmapGet(phmap,(unsigned long)(ap->aid))) != NULL)
{
printf(".");
plen = np->len;
for(i=0;i<plen-1;i++)
{
fprintf(fp,"%ld,",np->aid[i]);
}
fprintf(fp,"%ld\n",np->aid[plen-1]);
}
printf("\n");fflush(NULL);
ap = ap->next;
}
fclose(fp);
}
@Eagles2F
Copy link

nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment