TRYAUTO.C
上传用户:qq5388545
上传日期:2022-07-04
资源大小:29849k
文件大小:1k
- #include <stdio.h>
- #include <io.h>
- #include <share.h>
- #include <fcntl.h>
- void main(void)
- {
- int handle;
- int offset = 0;
- int bytes_read;
- char buffer[128];
- if ((handle = sopen("\AUTOEXEC.BAT", O_BINARY | O_RDONLY, SH_DENYNO)) == -1)
- printf("Error opening AUTOEXEC.BATn");
- else
- {
- while (bytes_read = read(handle, buffer, 1))
- {
- if (bytes_read == -1)
- printf("Error reading offset %dn", offset);
- else
- write(1, buffer, bytes_read);
- offset++;
- lseek(handle, offset, SEEK_SET);
- }
- close(handle);
- }
- }