libqi  1.12
qi/os.hpp
Go to the documentation of this file.
00001 
00009 /*
00010  * Various cross-platform OS related functions
00011  *
00012  * \note Every path taken in parameter MUST be encoded in UTF8.
00013  * \note Every path returned are encoded in UTF8.
00014  */
00015 
00016 #pragma once
00017 #ifndef _LIBQI_QI_OS_HPP_
00018 #define _LIBQI_QI_OS_HPP_
00019 
00020 # include <string>
00021 # include <qi/config.hpp>
00022 
00023 struct stat;
00024 
00025 namespace qi {
00026 
00027   namespace os {
00028 
00029     QI_API FILE* fopen(const char *filename, const char *mode);
00030     QI_API int stat(const char *filename, struct stat *pstat);
00031     QI_API int checkdbg();
00032     QI_API std::string home();
00033     QI_API std::string tmpdir(const char *prefix = "");
00034 
00035     // env
00036     QI_API std::string getenv(const char *var);
00037     QI_API int setenv(const char *var, const char *value);
00038 
00039     // time
00040     QI_API void sleep(unsigned int seconds);
00041     QI_API void msleep(unsigned int milliseconds);
00042     struct QI_API timeval {
00043       long tv_sec;
00044       long tv_usec;
00045     };
00046     QI_API int gettimeofday(qi::os::timeval *tp);
00047 
00048     // shared library
00049     QI_API void *dlopen(const char *filename, int flag = -1);
00050     QI_API int dlclose(void *handle);
00051     QI_API void *dlsym(void *handle, const char *symbol);
00052     QI_API const char *dlerror(void);
00053 
00054     // process management
00055     QI_API int spawnvp(char *const argv[]);
00056     QI_API int spawnlp(const char* argv, ...);
00057     QI_API int system(const char *command);
00058     QI_API int waitpid(int pid, int* status);
00059 
00060   };
00061 };
00062 
00063 
00064 #endif  // _LIBQI_QI_OS_HPP_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines