TRYAUTO.C
Upload User: qq5388545
Upload Date: 2022-07-04
Package Size: 29849k
Code Size: 1k
Category:

GUI Develop

Development Platform:

C/C++

  1. #include <stdio.h>
  2. #include <io.h>
  3. #include <share.h>
  4. #include <fcntl.h>
  5. void main(void)
  6.  {
  7.    int handle;
  8.    int offset = 0;
  9.    int bytes_read;
  10.    char buffer[128];
  11.    if ((handle = sopen("\AUTOEXEC.BAT", O_BINARY | O_RDONLY, SH_DENYNO)) == -1)
  12.      printf("Error opening AUTOEXEC.BATn");
  13.    else
  14.     {
  15.       while (bytes_read = read(handle, buffer, 1)) 
  16.        {   
  17.          if (bytes_read == -1)
  18.            printf("Error reading offset %dn", offset);
  19.          else
  20.            write(1, buffer, bytes_read);
  21.          offset++;
  22.          lseek(handle, offset, SEEK_SET);
  23.        }
  24.       close(handle);
  25.     }
  26.  }