home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------*/
- /* ╡{ªí└╔ªW║┘: wat149.c */
- /*------------------------------------------------------------------*/
- #include <stdio.h>
- #include <fcntl.h>
- #include <sys\stat.h>
- #include <io.h>
-
- void main()
- {
- int result;
- int handle;
- char data1[] = "FoxPro 2.0 └│Ñ╬╡{ªí¼╔¡▒ API---by Alex Jang\n";
- char data2[] = "(╗P C ñ╬ Assembly ñº│s╡▓)";
- char buf;
-
- /* ÑHñG╢iª∞┴Uªí½╪Ñ▀ñ@¡╙└╔«╫ */
- handle = open("MYFILE.$$$", O_CREAT | O_RDWR | O_BINARY, S_IREAD | S_IWRITE);
-
- /* ▒N╕Ω«╞╝gñJ└╔«╫ññ */
- write(handle, data1, strlen(data1));
- write(handle, data2, strlen(data2));
- /* ▒N└╔«╫½ⁿ╝╨▓╛ª▄└╔«╫¬║╢}└Y│B */
- lseek(handle, 0L, SEEK_SET);
-
- /* ▒q└╔«╫ññ┼¬¿·ªrñ╕¬╜¿∞ EOF ¼░ñε */
- while (!eof(handle))
- {
- read(handle, &buf, 1);
- printf("%c", buf);
- }
-
- /* ¡½│]└╔«╫╝╥ªí¼░ñσªr╝╥ªí */
- result = setmode(handle, O_TEXT);
- if (result == -1)
- perror("\n└╔«╫╝╥ªí¡½│]Ñó▒╤\n");
- else
- printf("\n└╔«╫╝╥ªíñw¡½│]ª¿ñσªr╝╥ªí\n");
-
- /* ├÷│¼└╔«╫ */
- close(handle);
- }
-