Share Pastebin
Guest
Public paste!

cromestant

By: a guest | May 21st, 2008 | Syntax: C | Size: 1.33 KB | Hits: 153 | Expires: Never
Copy text to clipboard
  1. USUARIO * addUser(char *uname,char *passwd)
  2. {
  3.         USUARIO *aux;
  4.         aux=(USUARIO *)malloc(sizeof(USUARIO *));
  5.         aux->username = uname;
  6.         aux->password =passwd;
  7.         return aux;
  8. }
  9.  
  10.  
  11. int loadPrefs(){
  12. /*      char todo[256],*uname,*password;
  13.         printf("Cagando configuraciones.%s \n","lista de archivos");
  14.         lista = (USUARIO *)malloc(sizeof(USUARIO *));
  15.         USUARIO *auxu = lista;
  16.         FILE *in;
  17.         in=fopen("configs/authusers.spa","r");
  18.         if (in==NULL){
  19.         printf("Error al abrir el archivo de configuracion configs/authusers.spa");
  20.         return -1;
  21.         }
  22.  
  23.         while (fgets(&todo,256,in)!=NULL)
  24.         {
  25.                 uname=strtok(&todo,"=");
  26.                 password =strtok(NULL,"=");
  27.                 printf("added %s : %s",uname,password);
  28.                 auxu->proximo=addUser(uname,password);
  29.                 auxu=auxu->proximo;
  30.         }
  31.         fclose(in);
  32.         return 1;
  33. */
  34.  
  35. printf("Cagando configuraciones.%s \n","lista de archivos");
  36.         lista = (USUARIO *)malloc(sizeof(USUARIO *));
  37.         lista->username ="cromestant";
  38.         lista->password="12345";
  39.         USUARIO *auxu = (USUARIO *)malloc(sizeof(USUARIO *));
  40.         auxu->username ="cromestant";
  41.         auxu->password ="testpassword";
  42.         lista->proximo =auxu;
  43. }