home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR13 / INIFIL.ZIP / INIFILE.DOC < prev    next >
Text File  |  1993-10-13  |  2KB  |  39 lines

  1. To:    brave users
  2. From:    George Byrkit
  3.         1809 Saxon St
  4.         Ann Arbor, MI 48103
  5.         313-663-1009
  6. Date:    13 October 1993
  7.  
  8. I thought I'd post this piece of code for you all to use, if you so wish.
  9. There is no support, but I'd like to know about bugs you find.
  10.  
  11. This code (inifile.cpp, inifile.h), implements the GetProfileString,
  12. GetProfileInt, WriteProfileString, GetPrivateProfileString, GetPrivateProfileInt
  13. and WritePrivateProfileString functions for use with DOS programs.
  14.  
  15. The non-private versions of the function look in the current directory to find
  16. the file 'win.ini'.  I'm not about to hunt for where windows is installed.  I
  17. would suggest using the private version and passing in the actual location, if
  18. you need it.
  19.  
  20. I've also included a simple program, editini.cpp, that makes use of the
  21. functions in inifile.cpp.
  22.  
  23. Please note that inifile.h is taken from a relavent section in windows.h, early
  24. on, where we get the datatypes needed, and actually use the definitions of
  25. the above functions that exist there.  This causes us to be compatible with the
  26. Windows API functions at the calling protocol level.
  27.  
  28. Although this particular coding was created and tested with BC/C++ 3.1, I
  29. believe it should port well to other compilers.
  30.  
  31. Warning:
  32. Assume the ini file name is foo.ini for the discussion of file names below.
  33. The technique used to write a new value is to read the original file, and create
  34. a copy that has the new value.  The original file is then renamed to a temporary
  35. name.  (original file name (s.b. *.ini) changed to foo.i$$).  The copy file is
  36. usually named 'foo.in$'.  The copy file is then renames to foo.ini.  The renamed
  37. original file is then deleted.  If anything goes wrong, a best effort is done to
  38. restore the original ini file.
  39.