home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a120 / 1.ddi / WATCOM_C / WAT149.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-11  |  1.1 KB  |  44 lines

  1. /*------------------------------------------------------------------*/
  2. /* ╡{ªí└╔ªW║┘: wat149.c                                             */
  3. /*------------------------------------------------------------------*/
  4. #include <stdio.h>
  5. #include <fcntl.h>
  6. #include <sys\stat.h>
  7. #include <io.h>
  8.  
  9. void main()
  10. {
  11.    int result;
  12.    int handle;
  13.    char data1[] = "FoxPro 2.0 └│Ñ╬╡{ªí¼╔¡▒ API---by Alex Jang\n";
  14.    char data2[] = "(╗P C ñ╬ Assembly ñº│s╡▓)";
  15.    char buf;
  16.  
  17.    /* ÑHñG╢iª∞┴Uªí½╪Ñ▀ñ@¡╙└╔«╫ */
  18.    handle = open("MYFILE.$$$", O_CREAT | O_RDWR | O_BINARY, S_IREAD | S_IWRITE);
  19.  
  20.    /* ▒N╕Ω«╞╝gñJ└╔«╫ññ */
  21.    write(handle, data1, strlen(data1));
  22.    write(handle, data2, strlen(data2));
  23.    /* ▒N└╔«╫½ⁿ╝╨▓╛ª▄└╔«╫¬║╢}└Y│B */
  24.    lseek(handle, 0L, SEEK_SET);
  25.  
  26.    /* ▒q└╔«╫ññ┼¬¿·ªrñ╕¬╜¿∞ EOF ¼░ñε */
  27.    while (!eof(handle))
  28.    {
  29.       read(handle, &buf, 1);
  30.       printf("%c", buf);
  31.    }
  32.  
  33.    /* ¡½│]└╔«╫╝╥ªí¼░ñσªr╝╥ªí */
  34.    result = setmode(handle, O_TEXT);
  35.    if (result == -1)
  36.       perror("\n└╔«╫╝╥ªí¡½│]Ñó▒╤\n");
  37.    else
  38.       printf("\n└╔«╫╝╥ªíñw¡½│]ª¿ñσªr╝╥ªí\n");
  39.  
  40.    /* ├÷│¼└╔«╫ */
  41.    close(handle);
  42. }
  43.  
  44.