class GOS

Operating System dependent functions.

Public Methods

[more]static int is_file(const char *filename)
Returns true if filename exists and is a regular file.
[more]static int is_dir(const char *filename)
Returns true if filename exists and is a directory.
[more]static GString dirname(const char *filename)
Returns the name of the parent directory of filename.
[more]static GString basename(const char *filename, const char *suffix=0)
Returns the last component of file name filename.
[more]static GString cwd(const char *dirname=0)
Sets and returns the current working directory.
[more]static GString expand_name(const char *filename, const char *fromdirname=0)
Returns fully qualified file names.
[more]static int deletefile(const char * filename)
Deletes file or directory filename.
[more]static unsigned long ticks()
Returns a number of elapsed milliseconds.
[more]static void sleep(int milliseconds)
Sleeps during the specified time expressed in milliseconds.
[more]static GString filename_to_url(const char *filename, const char *useragent=0)
Returns a URL for accessing the file filename.
[more]static GString url_to_filename(const char *url)
Returns a filename for a URL.


Documentation

Operating System dependent functions.
ostatic int is_file(const char *filename)
Returns true if filename exists and is a regular file.

ostatic int is_dir(const char *filename)
Returns true if filename exists and is a directory.

ostatic GString dirname(const char *filename)
Returns the name of the parent directory of filename. This function works like the unix command /bin/dirname, but also supports the naming conventions of other operating systems.

ostatic GString basename(const char *filename, const char *suffix=0)
Returns the last component of file name filename. If the filename suffix matches argument suffix, the filename suffix is removed. This function works like the unix command /bin/basename, but also supports the naming conventions of other operating systems.

ostatic GString cwd(const char *dirname=0)
Sets and returns the current working directory. When argument dirname is specified, the current directory is changed to dirname. This function always returns the fully qualified name of the current directory.

ostatic GString expand_name(const char *filename, const char *fromdirname=0)
Returns fully qualified file names. This functions constructs the fully qualified name of file or directory filename. When provided, the optional argument fromdirname is used as the current directory when interpreting relative specifications in filename. Function

knows which separators should be used for each operating system and it knows which syntactical rules apply.

ostatic int deletefile(const char * filename)
Deletes file or directory filename. Directories are not deleted unless the directory is empty. Returns a negative number if an error occurs.

ostatic unsigned long ticks()
Returns a number of elapsed milliseconds. This number counts elapsed milliseconds since a operating system dependent date. This function is useful for timing code.

ostatic void sleep(int milliseconds)
Sleeps during the specified time expressed in milliseconds. Other threads can run while the calling thread sleeps.

ostatic GString filename_to_url(const char *filename, const char *useragent=0)
Returns a URL for accessing the file filename. This function normally constructs a standard file URL as described in RFC 1738. Some versions of MSIE do not support this standard syntax. A brain damaged MSIE compatible syntax is generated when the optional argument useragent contains string "MSIE" or "Microsoft".

ostatic GString url_to_filename(const char *url)
Returns a filename for a URL. Argument url must be a legal file URL. This function applies heuristic rules to convert the URL into a valid file name. It is guaranteed that this function can properly parse all URLs generated by filename_to_url. The heuristics also work better when the file actually exists. The empty string is returned when this function cannot parse the URL or when the URL is not a file URL.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java