Advertisement
Guest User

defines.h

a guest
Sep 21st, 2011
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #ifndef _defines_included
  2.     #define _defines_included
  3. #endif
  4.  
  5. #define LUSER_FILE "usconsole.db"
  6. #define LPASS_FILE "psconsole.db"
  7. #define LLOGS_FILE "logconsole.db"
  8. #define MAX_PASS_SIZE 16
  9. #define MAX_NAME_SIZE 32
  10.  
  11.  
  12. void sleep(unsigned int mseconds)
  13. {
  14.     clock_t goal = mseconds + clock();
  15.     while (goal > clock());
  16. }
  17.  
  18. int fexist(const char* filename) {
  19.   FILE* fp;
  20.   fp = fopen(filename, "r");
  21.   if (fp==0) return 0;
  22.   fclose(fp);
  23.   return 1;
  24. }
  25.  
  26. int fexist_(char* filename, int* len) {
  27.   int i;
  28.   char* tmpname;
  29.  
  30.   tmpname = (char*)calloc(((*len)+1),sizeof(char));
  31.   for (i=0; i<(*len); i++) {
  32.     tmpname[i] = filename[i];
  33.   }
  34.   tmpname[(*len)] = '\0';
  35.   i = fexist(tmpname);
  36.   free(tmpname);
  37.   return i;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement