Qore Programming Language Reference Manual  0.9.3
QC_File.dox.h
1 namespace Qore {
4 
50 class File : public ReadOnlyFile {
51 
52 public:
54 
69 nothing chown(softint uid, softint gid = -1);
70 
71 public:
73 
89  constructor(*string encoding);
90 
91 public:
93 
98  copy();
99 
100 public:
102 
104  destructor();
105 
106 public:
108 
129 int f_printf(string fmt, ...);
130 
131 public:
133 
138 int f_printf();
139 
140 public:
142 
164 int f_vprintf(string fmt, any fmt_args);
165 
166 public:
168 
173 int f_vprintf();
174 
175 public:
177 
184 string getCharset();
185 
186 public:
188 
211 hash getLockInfo();
212 
213 public:
215 
233 nothing getTerminalAttributes(TermIOS termios);
234 
235 public:
237 
255 
256 public:
258 
288 int lock(softint type = F_RDLCK, softint start = 0, softint len = 0, softint whence = SEEK_SET);
289 
290 public:
292 
320 nothing lockBlocking(softint type = F_RDLCK, softint start = 0, softint len = 0, softint whence = SEEK_SET);
321 
322 public:
324 
351 int open(string path, softint flags = O_RDONLY, softint mode = 0666, *string encoding);
352 
353 public:
355 
387 nothing open2(string path, softint flags = O_RDONLY, softint mode = 0666, *string encoding);
388 
389 public:
391 
411 int print(string data);
412 
413 public:
415 
436 int printf(string fmt, ...);
437 
438 public:
440 
445 int printf();
446 
447 public:
449 
465 nothing redirect(Qore::File file);
466 
467 public:
469 
474 nothing setCharset(*string encoding);
475 
476 public:
478 
511 nothing setTerminalAttributes(softint action = TCSANOW, TermIOS termios);
512 
513 public:
515 
525 int sync();
526 
527 public:
529 
551 int vprintf(string fmt, any fmt_args);
552 
553 public:
555 
560 int vprintf();
561 
562 public:
564 
581 int write(binary data);
582 
583 public:
585 
605 int write(string data);
606 
607 public:
609 
626 int writei1(int c);
627 
628 public:
630 
647 int writei2(int s);
648 
649 public:
651 
668 int writei2LSB(int s);
669 
670 public:
672 
689 int writei4(int i);
690 
691 public:
693 
710 int writei4LSB(int i);
711 
712 public:
714 
731 int writei8(int i);
732 
733 public:
735 
752 int writei8LSB(int i);
753 };
758 
764  const O_CREAT = O_CREAT;
770  const O_EXCL = O_EXCL;
782  const O_RDWR = O_RDWR;
784  const O_SYNC = O_SYNC;
786  const O_TRUNC = O_TRUNC;
790 
796 
798  const F_RDLCK = F_RDLCK;
800  const F_UNLCK = F_UNLCK;
802  const F_WRLCK = F_WRLCK;
804 
808 
816 };
TermIOS getTerminalAttributes()
Returns the current terminal attributes for the file as a TermIOS object returned as the return value...
int writei2LSB(int s)
Writes a 2-byte (16 bit) integer to the file in binary little-endian format.
const TCSANOW
make change immediate
Definition: QC_TermIOS.dox.h:471
const O_EXCL
Raise an error if used with O_CREAT and the file exists.
Definition: QC_File.dox.h:770
constructor(*string encoding)
Creates the File object.
copy()
Creates a new File object with the same character encoding specification as the original,...
hash getLockInfo()
Returns a hash of lock information.
const F_UNLCK
Use for unlocking a lock.
Definition: QC_File.dox.h:800
nothing chown(softint uid, softint gid=-1)
Changes the user and group owners of the file on the filesystem (if the current user has sufficient p...
int writei8(int i)
Writes an 8-byte (64 bit) integer to the file in binary big-endian format.
int f_vprintf()
This method variant does nothing except return a constant 0; it is only included for backwards-compat...
nothing lockBlocking(softint type=F_RDLCK, softint start=0, softint len=0, softint whence=SEEK_SET)
Attempts to lock the file according to the arguments passed, blocking.
const O_RDWR
Open for reading and writing.
Definition: QC_File.dox.h:782
int vprintf()
This method variant does nothing except return a constant 0; it is only included for backwards-compat...
int writei4(int i)
Writes a 4-byte (32 bit) integer to the file in binary big-endian format.
binary binary()
Always returns an empty binary object (of zero length)
const O_NOFOLLOW
don't follow links (0 on platforms where this is not available)
Definition: QC_File.dox.h:776
const SEEK_CUR
Indicates that the offset is from the current position in the file.
Definition: QC_File.dox.h:810
int writei1(int c)
Writes a 1-byte integer to the file.
const O_DIRECTORY
must be a directory (0 on platforms where this is not available)
Definition: QC_File.dox.h:768
const O_DIRECT
direct disk access hint (0 on platforms where this is not available)
Definition: QC_File.dox.h:766
const O_APPEND
Open the file in append mode (append on each write)
Definition: QC_File.dox.h:762
int sync()
Flushes the file's buffer to disk.
int f_printf()
This method variant does nothing except return a constant 0; it is only included for backwards-compat...
int printf()
This method variant does nothing except return a constant 0; it is only included for backwards-compat...
const O_NONBLOCK
non-blocking I/O (untested with Qore; 0 on platforms where this is not available)
Definition: QC_File.dox.h:778
const O_ACCMODE
Mask for access modes (O_RDONLY|O_WRONLY|O_RDWR)
Definition: QC_File.dox.h:760
int writei8LSB(int i)
Writes an 8-byte (64 bit) integer to the file in binary little-endian format.
const F_RDLCK
Use for read-only locking.
Definition: QC_File.dox.h:798
nothing open2(string path, softint flags=O_RDONLY, softint mode=0666, *string encoding)
Opens a file in a particular mode; throws an exception on failure.
const O_CREAT
Create the file if it doesn't exist.
Definition: QC_File.dox.h:764
const SEEK_END
Indicates that the offset is from the end of the file.
Definition: QC_File.dox.h:812
string type(auto arg)
Returns a string giving the data type of the argument passed; see String Type Constants for the value...
int write(binary data)
Writes binary data to a file.
hash< auto > hash(object obj)
Returns a hash of an object's members.
const O_NOCTTY
don't allocate controlling tty (0 on platforms where this is not available)
Definition: QC_File.dox.h:774
destructor()
Closes the File if it is open and destroys the File object.
const F_WRLCK
Use for exclusive write locking.
Definition: QC_File.dox.h:802
int lock(softint type=F_RDLCK, softint start=0, softint len=0, softint whence=SEEK_SET)
Attempts to lock the file according to the arguments passed, does not block.
int writei2(int s)
Writes a 2-byte (16 bit) integer to the file in binary big-endian format.
const O_NDELAY
synonym for O_NONBLOCK (untested with Qore; 0 on platforms where this is not available)
Definition: QC_File.dox.h:772
string getCharset()
Returns the character encoding for the File.
int print(string data)
Writes string data to a file; string data is converted to the File's character encoding if necessary ...
const O_WRONLY
Open the file write-only.
Definition: QC_File.dox.h:788
const O_SYNC
synchronized file update option (0 on platforms where this is not available)
Definition: QC_File.dox.h:784
int writei4LSB(int i)
Writes a 4-byte (32 bit) integer to the file in binary little-endian format.
const O_RDONLY
Open the file read-only.
Definition: QC_File.dox.h:780
The File class allows Qore programs to read, write, and create files.
Definition: QC_File.dox.h:50
nothing setTerminalAttributes(softint action=TCSANOW, TermIOS termios)
Sets the current terminal attributes for the File from the TermIOS object passed; does not change the...
const SEEK_SET
Indicates that the offset is from the start of the file.
Definition: QC_File.dox.h:814
This class allows Qore scripts to get or set terminal settings on UNIX platforms.
Definition: QC_TermIOS.dox.h:44
const O_TRUNC
Truncate the size to zero.
Definition: QC_File.dox.h:786
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:2
The ReadOnlyFile class allows Qore programs to read existing files.
Definition: QC_ReadOnlyFile.dox.h:18
nothing setCharset(*string encoding)
Sets the character encoding for the file; if called with no argument, the default encoding is set.
nothing redirect(Qore::File file)
redirects an existing file to another file
int open(string path, softint flags=O_RDONLY, softint mode=0666, *string encoding)
Opens a File in a particular mode, returns an error code on failure.