4 * Copyright 1995-2002 the LyX Team
5 * Read the file COPYING
7 * A selection of useful system functions made
20 /// get the current working directory
21 string const getcwd();
22 /// change to a directory, 0 is returned on success.
23 int chdir(string const & name);
25 * rename a file, returns false if it fails.
26 * It can handle renames across partitions.
28 bool rename(string const & from, string const & to);
29 /// copy a file, returns false it it fails
30 bool copy(string const & from, string const & to);
31 /// generates a checksum of a file
32 unsigned long sum(string const & file);
33 /// FIXME: some point to this hmm ?
34 int kill(int pid, int sig);
37 /// create the given directory with the given mode
38 int mkdir(string const & pathname, unsigned long int mode);
39 /// put a C string into the environment
40 int putenv(char const * str);
41 /// unlink the given file
42 int unlink(string const & file);
43 /// remove the given directory
44 int rmdir(string const & file);
45 /// convert the given string to an integer
46 int atoi(string const & nstr);
47 /// (securely) create a temporary file in the given dir with the given prefix
48 string const tempName(string const & dir = string(),
49 string const & mask = string());
53 * Returns true if var is approximately equal to number with allowed error
56 * Usage: if (float_equal(var, number, 0.0001)) { }
58 * This will check if 'var' is approx. equal to 'number' with error of 1/1000
60 inline bool float_equal(float var, float number, float error)
62 return (number - error <= var && var <= number + error);
67 #endif /* LYX_LIB_H */