Concept Framework 2.2 documentation Contents | Index

standard.C.io.fputs

Name Version Deprecated
fputs version 1.0 no

Prototype:
number fputs(string buffer, number fd)

Parameters:
buffer      [in] Output string
fd      [in] A valid file descriptor

Description:
fputs copies buffer to the output stream fd at the current position, without the terminating null character.

Example:
import standard.C.io

define FILENAME     "test.txt"

class Main {
     function Main() {
          var fd; 
          var buffer = "Testing fputs.";     

          // Open file for write
          if (fd = fopen(FILENAME, "w")) {               
               if (fputs(buffer, fd))
                    echo "fputs error\n";                    
               else
                    echo "fputs success\n";
               fclose(fd);
          } else
               echo "Problem opening the file\n";
          
     }
}  

Results 
fputs success  

Returns:
fputs returns a negative value if it is successful.

Documented by Simona Plesuvu, generation time: Sun Jan 27 18:15:16 2013 GMT(c)2013 Devronium Applications