home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a120 / 1.ddi / WATCOM_C / WAT142.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-18  |  878 b   |  35 lines

  1. /*------------------------------------------------------------------*/
  2. /* ╡{ªí└╔ªW║┘: wat142.c                                             */
  3. /*------------------------------------------------------------------*/
  4. #include <stdio.h>
  5. #include <fcntl.h>
  6. #include <sys\stat.h>
  7.  
  8. void main()
  9. {
  10.    char buf[512];
  11.    char *data="º╓╝╓¿∞⌐│¼Oñ░╗≥¬FªΦ !\nº╓╝╓┤N¼O╛╟▓▀ FoxPro..(ñ╙░╢ñjñF, ░_Ñ▀╣¬┤x)";
  12.  
  13.    int handle, bytes;
  14.  
  15.    if ((handle =
  16.       open("TEST.TXT", O_RDWR | O_CREAT | O_TRUNC | O_TEXT,
  17.                        S_IWRITE | S_IREAD)) == -1)
  18.    {
  19.       printf("╢}└╔┐∙╗~\n");
  20.       exit(1);
  21.    }
  22.  
  23.    write(handle, data, strlen(data));
  24.    lseek(handle, 0L, SEEK_SET);
  25.    if ((bytes = read(handle, buf, strlen(data))) == -1)
  26.    {
  27.         printf("┼¬¿·Ñó▒╤.\n");
  28.         exit(1);
  29.    }
  30.    else
  31.    {
  32.       printf("ª@┼¬¿· %d ¡╙ª∞ñ╕▓╒.\n", bytes);
  33.    }
  34. }
  35.