home *** CD-ROM | disk | FTP | other *** search
/ Best Objectech Shareware Selections / UNTITLED.iso / boss / grap / util / 020 / example1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-04  |  1.3 KB  |  46 lines

  1. /*
  2.     Example1.C version 1.0
  3.     by Robert Schmidt of Ztiff Zox Softwear 1993
  4.  
  5.     Example of making use of a TWEAK file by loading it directly at
  6.         run-time.  This program needs the file(s) created by TWEAK
  7.         available at run-time.
  8. */
  9.  
  10. #include <conio.h>
  11. #include "TwkUser.h"    /* declares the neccessary functions and types */
  12.  
  13. main()
  14.     {
  15.     /* Define the pointer that should point to the loaded array of
  16.        Registers, and the int to hold its size */
  17.  
  18.     RegisterPtr rarray;
  19.     int rsize;
  20.  
  21.     /* Now use the loadRegArray function declared in TwkUser.h to load the
  22.        TWEAK file.  Memory is automatically allocated.  Note that the
  23.        second argument is the address of the pointer defined above!
  24.        The returned value is the number of Register elements loaded. */
  25.  
  26.     rsize = loadRegArray("320x240.256", &rarray);
  27.  
  28.     /* rarray now points to the loaded array.  The second argument to
  29.        outRegArray is the number if Register elements in the array. */
  30.  
  31.     outRegArray(rarray, rsize);
  32.  
  33.     /* The mode is now set, so wait for the user to press a key...
  34.        Nothing much interesting to look at, I'm afraid. */
  35.  
  36.     getch();
  37.     textmode(C80);
  38.  
  39.     /* Free the Register array allocated in loadRegArray.  *You* are
  40.        responsible for doing this! */
  41.  
  42.     free(rarray);
  43.  
  44.     return 0;
  45.     }
  46.