home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------*/
- /* ╡{ªí└╔ªW║┘: wat59.c */
- /*------------------------------------------------------------------*/
- #include <string.h>
- #include <stdio.h>
- #include <conio.h>
- #include <io.h>
-
- void flush(FILE *stream);
-
- void main()
- {
- FILE *fp;
- char msg[] = "dup() ¿τ╝╞ñº┤·╕╒╜m▓▀";
-
- /* ½╪Ñ▀ñ@¡╙└╔«╫ */
- fp = fopen("MYFILE.TXT", "w");
-
- /* ╝gñJñ@¿╟╕Ω«╞ª▄ª╣└╔«╫ññ */
- fwrite(msg, strlen(msg), 1, fp);
-
- printf("╜╨½÷Ñ⌠ñ@┴Σ╢}⌐l╝gñJ MYFILE.TXT");
-
- getch();
-
- /* ªbñú├÷│¼ MYFILE.TXT ñº¬¼║AñU▒N╕Ω«╞╝gñJ MYFILE.TXT */
- flush(fp);
-
- printf("\n└╔«╫ñw│Q╝gñJ, ╜╨½÷Ñ⌠ñ@┴Σ┬≈╢} ");
- getch();
- }
-
- void flush(FILE *stream)
- {
- int duphandle;
-
- fflush(stream);
-
- /* ╜╞╗sñ@¡╙└╔«╫▒▒╗s╜X */
- duphandle = dup(fileno(stream));
- close(duphandle);
- }