Qore Programming Language Reference Manual  0.9.4.3
QC_File.dox.h
1 
3 namespace Qore {
5 
51 class File : public ReadOnlyFile {
52 
53 public:
55 
70 nothing chown(softint uid, softint gid = -1);
71 
72 public:
74 
90  constructor(*string encoding);
91 
92 public:
94 
99  copy();
100 
101 public:
103 
105  destructor();
106 
107 public:
109 
130 int f_printf(string fmt, ...);
131 
132 public:
134 
139 int f_printf();
140 
141 public:
143 
165 int f_vprintf(string fmt, any fmt_args);
166 
167 public:
169 
174 int f_vprintf();
175 
176 public:
178 
185 string getCharset();
186 
187 public:
189 
212 hash getLockInfo();
213 
214 public:
216 
234 nothing getTerminalAttributes(TermIOS termios);
235 
236 public:
238 
256 
257 public:
259 
289 int lock(softint type = F_RDLCK, softint start = 0, softint len = 0, softint whence = SEEK_SET);
290 
291 public:
293 
321 nothing lockBlocking(softint type = F_RDLCK, softint start = 0, softint len = 0, softint whence = SEEK_SET);
322 
323 public:
325 
352 int open(string path, softint flags = O_RDONLY, softint mode = 0666, *string encoding);
353 
354 public:
356 
388 nothing open2(string path, softint flags = O_RDONLY, softint mode = 0666, *string encoding);
389 
390 public:
392 
412 int print(string data);
413 
414 public:
416 
437 int printf(string fmt, ...);
438 
439 public:
441 
446 int printf();
447 
448 public:
450 
466 nothing redirect(Qore::File file);
467 
468 public:
470 
475 nothing setCharset(*string encoding);
476 
477 public:
479 
512 nothing setTerminalAttributes(softint action = TCSANOW, TermIOS termios);
513 
514 public:
516 
526 int sync();
527 
528 public:
530 
552 int vprintf(string fmt, any fmt_args);
553 
554 public:
556 
561 int vprintf();
562 
563 public:
565 
582 int write(binary data);
583 
584 public:
586 
606 int write(string data);
607 
608 public:
610 
627 int writei1(int c);
628 
629 public:
631 
648 int writei2(int s);
649 
650 public:
652 
669 int writei2LSB(int s);
670 
671 public:
673 
690 int writei4(int i);
691 
692 public:
694 
711 int writei4LSB(int i);
712 
713 public:
715 
732 int writei8(int i);
733 
734 public:
736 
753 int writei8LSB(int i);
754 };
760  const O_ACCMODE = O_ACCMODE;
765  const O_CREAT = O_CREAT;
771  const O_EXCL = O_EXCL;
783  const O_RDWR = O_RDWR;
785  const O_SYNC = O_SYNC;
787  const O_TRUNC = O_TRUNC;
798  const F_RDLCK = F_RDLCK;
801  const F_UNLCK = F_UNLCK;
803  const F_WRLCK = F_WRLCK;
810  const SEEK_CUR = SEEK_CUR;
817 }
Qore::File::sync
int sync()
Flushes the file's buffer to disk.
Qore::O_EXCL
const O_EXCL
Raise an error if used with O_CREAT and the file exists.
Definition: QC_File.dox.h:771
Qore::O_APPEND
const O_APPEND
Open the file in append mode (append on each write)
Definition: QC_File.dox.h:763
Qore::File::open2
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.
Qore::O_NOCTTY
const O_NOCTTY
don't allocate controlling tty (0 on platforms where this is not available)
Definition: QC_File.dox.h:775
Qore::type
string type(auto arg)
Returns a string giving the data type of the argument passed; see String Type Constants for the value...
Qore::O_RDWR
const O_RDWR
Open for reading and writing.
Definition: QC_File.dox.h:783
Qore::SEEK_SET
const SEEK_SET
Indicates that the offset is from the start of the file.
Definition: QC_File.dox.h:815
Qore::O_NDELAY
const O_NDELAY
synonym for O_NONBLOCK (untested with Qore; 0 on platforms where this is not available)
Definition: QC_File.dox.h:773
Qore::File::printf
int printf()
This method variant does nothing except return a constant 0; it is only included for backwards-compat...
Qore::File::setCharset
nothing setCharset(*string encoding)
Sets the character encoding for the file; if called with no argument, the default encoding is set.
Qore::File::lock
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.
Qore::File::redirect
nothing redirect(Qore::File file)
redirects an existing file to another file
Qore::File::writei2
int writei2(int s)
Writes a 2-byte (16 bit) integer to the file in binary big-endian format.
Qore::TermIOS
This class allows Qore scripts to get or set terminal settings on UNIX platforms.
Definition: QC_TermIOS.dox.h:45
Qore::File::getCharset
string getCharset()
Returns the character encoding for the File.
Qore::File::write
int write(binary data)
Writes binary data to a file.
Qore::File::writei4LSB
int writei4LSB(int i)
Writes a 4-byte (32 bit) integer to the file in binary little-endian format.
Qore::File::print
int print(string data)
Writes string data to a file; string data is converted to the File's character encoding if necessary ...
Qore::File::setTerminalAttributes
nothing setTerminalAttributes(softint action=TCSANOW, TermIOS termios)
Sets the current terminal attributes for the File from the TermIOS object passed; does not change the...
Qore::O_TRUNC
const O_TRUNC
Truncate the size to zero.
Definition: QC_File.dox.h:787
Qore::O_NONBLOCK
const O_NONBLOCK
non-blocking I/O (untested with Qore; 0 on platforms where this is not available)
Definition: QC_File.dox.h:779
Qore::F_UNLCK
const F_UNLCK
Use for unlocking a lock.
Definition: QC_File.dox.h:801
Qore::File::writei4
int writei4(int i)
Writes a 4-byte (32 bit) integer to the file in binary big-endian format.
Qore::File
The File class allows Qore programs to read, write, and create files.
Definition: QC_File.dox.h:51
Qore::File::writei2LSB
int writei2LSB(int s)
Writes a 2-byte (16 bit) integer to the file in binary little-endian format.
Qore::File::copy
copy()
Creates a new File object with the same character encoding specification as the original,...
Qore::File::getTerminalAttributes
TermIOS getTerminalAttributes()
Returns the current terminal attributes for the file as a TermIOS object returned as the return value...
Qore::File::open
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.
Qore::hash
hash< auto > hash(object obj)
Returns a hash of an object's members.
Qore::O_CREAT
const O_CREAT
Create the file if it doesn't exist.
Definition: QC_File.dox.h:765
Qore::File::vprintf
int vprintf()
This method variant does nothing except return a constant 0; it is only included for backwards-compat...
Qore::O_WRONLY
const O_WRONLY
Open the file write-only.
Definition: QC_File.dox.h:789
Qore::File::writei8
int writei8(int i)
Writes an 8-byte (64 bit) integer to the file in binary big-endian format.
Qore::File::lockBlocking
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.
Qore::O_DIRECT
const O_DIRECT
direct disk access hint (0 on platforms where this is not available)
Definition: QC_File.dox.h:767
Qore::F_WRLCK
const F_WRLCK
Use for exclusive write locking.
Definition: QC_File.dox.h:803
Qore::O_RDONLY
const O_RDONLY
Open the file read-only.
Definition: QC_File.dox.h:781
Qore::File::constructor
constructor(*string encoding)
Creates the File object.
Qore::File::getLockInfo
hash getLockInfo()
Returns a hash of lock information.
Qore::F_RDLCK
const F_RDLCK
Use for read-only locking.
Definition: QC_File.dox.h:799
Qore::File::writei1
int writei1(int c)
Writes a 1-byte integer to the file.
Qore::File::f_vprintf
int f_vprintf()
This method variant does nothing except return a constant 0; it is only included for backwards-compat...
Qore::O_SYNC
const O_SYNC
synchronized file update option (0 on platforms where this is not available)
Definition: QC_File.dox.h:785
Qore::O_ACCMODE
const O_ACCMODE
Mask for access modes (O_RDONLY|O_WRONLY|O_RDWR)
Definition: QC_File.dox.h:761
Qore::File::writei8LSB
int writei8LSB(int i)
Writes an 8-byte (64 bit) integer to the file in binary little-endian format.
Qore::O_DIRECTORY
const O_DIRECTORY
must be a directory (0 on platforms where this is not available)
Definition: QC_File.dox.h:769
Qore::File::chown
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...
Qore::File::f_printf
int f_printf()
This method variant does nothing except return a constant 0; it is only included for backwards-compat...
Qore::SEEK_CUR
const SEEK_CUR
Indicates that the offset is from the current position in the file.
Definition: QC_File.dox.h:811
Qore::SEEK_END
const SEEK_END
Indicates that the offset is from the end of the file.
Definition: QC_File.dox.h:813
Qore::O_NOFOLLOW
const O_NOFOLLOW
don't follow links (0 on platforms where this is not available)
Definition: QC_File.dox.h:777
Qore
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3
Qore::ReadOnlyFile
The ReadOnlyFile class allows Qore programs to read existing files.
Definition: QC_ReadOnlyFile.dox.h:19
Qore::File::destructor
destructor()
Closes the File if it is open and destroys the File object.
Qore::TCSANOW
const TCSANOW
make change immediate
Definition: QC_TermIOS.dox.h:472
Qore::binary
binary binary()
Always returns an empty binary object (of zero length)