MoteHost: Improve error checking when daemonizing
[remote/remote-mci.git] / libutil / File.h
blob826fd2c8f860649fbd85c62e44ea79cc6aa3882b
1 #ifndef REMOTE_UTIL_FILE_H
2 #define REMOTE_UTIL_FILE_H
4 #include <string>
6 namespace remote { namespace util {
8 /** File utility methods.
10 * This class provides various file related utility methods.
12 class File
14 public:
15 /** Read whole file into string.
17 * @param filename The name of the file to read.
18 * @return The content of the file.
20 static std::string readFile(std::string filename);
22 /** Read destination of symbolic link.
24 * @param linkname The name of the symbolic link to read.
25 * @return The destination path of the symlink.
27 static std::string readLink(std::string linkname);
29 /** Write data to file.
31 * @param filename The name of the file to write.
32 * @param data The file content.
33 * @param datalen The length of the content.
35 static bool writeFile(std::string filename, const void *data, uint32_t datalen);
40 #endif