spice- application::main--init_globals--init_logger
来源:互联网 发布:ubuntu 添加硬盘 编辑:程序博客网 时间:2024/06/08 02:16
void Platform::get_app_data_dir(std::string& path, const std::string& app_name){ const char* home_dir = getenv("HOME"); //get the environment variable , return the pointer if (!home_dir || strlen(home_dir) == 0) { //dir is null throw Exception("get home dir failed"); // throw exception } path = home_dir; std::string::iterator end = path.end(); // define the iterator of string while (end != path.begin() && *(end - 1) == '/') { path.erase(--end); // delete the symbol '/' } path += "/."; // add /. path += app_name; // add app_name if (mkdir(path.c_str(), 0700) == -1 && errno != EEXIST) { // dreate the appdata dir throw Exception("create appdata dir failed"); // S_IRWXU 00700 stand for owner have the authorization of read write operate } //errno record the system last error code ,whose value is the type of int . } //#define EEXIST 17 /* File exists */
1. getenv()函数
char *getenv(char *envvar);
函数说明:getenv()用来取得参数envvar环境变量的内容。参数envvar为环境变量的名称,如果该变量存在则会返回指向该内容的指针。环境变量的格式为envvar=value。getenv函数的返回值存储在一个全局二维数组里,当你再次使用getenv函数时不用担心会覆盖上次的调用结果。
返回值: 执行成功则返回指向该内容的指针,找不到符合的环境变量名称则返回NULL。如果变量存在但无关联值,它将运行成功并返回一个空字符串,即该字符的第一个字节是null。
http://baike.baidu.com/view/752598.htm
2.fopen()函数
FILE * fopen(const char * path,const char * mode);
参数说明
。。。。。。
http://baike.baidu.com/view/656681.htm
a 以附加的方式打开只写文件。若文件不存在,则会建立该文件,如果文件存在,写入的数据会被加到文件尾,即文件原先的内容会被保留。(EOF符保留)
。。。。。。
3.HOME
返回当前的用户路径
4.mkdir()函数
int mkdir(char * dir, int mode):目录创建函数
运用条件:只能在已存在的目录下建立一级子目录
返回值:
返回0表示成功,返回-1表述出错。
头文件:sys/stat.h
http://baike.baidu.com/view/1279338.htm
http://blog.csdn.net/rabbiteatpumpkin/article/details/6445321
errno parameter defintion
http://baike.baidu.com/view/3485007.htm
- spice- application::main--init_globals--init_logger
- spice Application.cpp ---function_to_func_name 2013-5-28
- spice-client源码解析之application.cpp
- spice
- main thread in android application
- ARM: LPC2000 APPLICATION DOES NOT REACH MAIN
- Add new application to the main menu
- Qt应用程序之Application Main Window详解
- Main application must be in the list of application paths
- Spice project
- spice vdagent
- spice debug
- SPICE 小计
- SPICE简史
- Exception in thread "main" org.apache.spark.SparkException: Application application_1498149692663_01
- spice client 和 spice server 通信机制
- spice client 和 spice server 通信机制
- spice client 和 spice server 通信机制
- XML学习总结
- 管理 Java 类路径 (Windows)
- ONVIF学习理解(3)
- vc常用函数
- Core Java Question List #7
- spice- application::main--init_globals--init_logger
- DAG(有向无环图) ------应用
- ONVIF学习理解(4)
- 试验设计[实验设计]
- SVM资料1
- Linux下查看端口占用情况
- Android 常用 mimeType 表
- hdu 1292递归
- asp.net和jsp的比较