home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / FPSE_src / system / win32 / init.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-01  |  1.6 KB  |  62 lines

  1. #include <windows.h>
  2. #include <io.h>
  3. #include <fcntl.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. #include <sys/types.h>
  7. #include <sys/stat.h>
  8.  
  9. #include "type.h"
  10. #include "init.h"
  11.  
  12. #define DATASIZE    1024  // size of destination buffer
  13.  
  14. // declare global variables
  15. static char INI_Name[256];      // self-explanatory
  16. static char LocalBuf[DATASIZE]; // storage area for data found
  17.  
  18. static char IniDefault[] = "\0"; // default string if no data or key,
  19.                                  // or section is found.
  20.  
  21.  
  22. int INI_Load(char *nf)
  23. {
  24.     int f;
  25.  
  26.     strcpy(INI_Name,nf);
  27.     f = open(nf,O_RDONLY | O_BINARY);
  28.     if (f==-1) return FPSE_ERR;
  29.     close(f);
  30.     return FPSE_OK;
  31. }
  32.  
  33. int INI_Save(char *nf)
  34. {
  35.     return FPSE_OK;
  36. }
  37.  
  38. void INI_Free() {}
  39.  
  40. int INI_Read(char *Section, char *Entry, char *Value)
  41. {
  42.     GetPrivateProfileString( Section,    // points to section name 
  43.                              Entry,      // points to key name 
  44.                              IniDefault, // points to default string 
  45.                              LocalBuf,   // points to destination buffer 
  46.                              DATASIZE,   // size of destination buffer 
  47.                              INI_Name    // points to ini file name 
  48.                            );
  49.     strcpy(Value,LocalBuf);
  50.     return FPSE_OK;
  51. }
  52.  
  53. int INI_Write(char *Section, char *Entry, char *Value)
  54. {
  55.     WritePrivateProfileString( Section, // pointer to section name 
  56.                                Entry,   // pointer to key name 
  57.                                Value,   // pointer to string to add 
  58.                                INI_Name // pointer to ini file name 
  59.                              );
  60.     return FPSE_OK;
  61. }
  62.