AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
freopen (String path, String mode, Stream stream) yoix.stdio
 
Closes stream, and then attaches it to the source named by path with access determined by mode, which should be one of:
"r" open for reading
"w" create or truncate for writing
"a" append; open for writing at the end of file, or create for writing
"r+" open for update, which allows reading and writing
"w+" truncate or create for update
freopen returns stream, or NULL if the re-open failed. In either case, the original stream is flushed and closed.
 
 Example:   On a UNIX-like system the program,
import yoix.stdio.*;

String  line[1024];

if (freopen("/etc/passwd", "r", stdin) != NULL) {
    while (fgets(line, 1024, stdin) != NULL)
        fputs(line, stdout);
}
copies the system password file to standard output.
 
 Return:   Stream
 
 See Also:   access, close, fclose, fflush, fopen, open, reopen, stat, unlink

 

Yoix is a registered trademark of AT&T Inc.