摘要: 转载http://www.cnblogs.com/xingyun/archive/2011/12/03/2274546.htmldirectory permission(目录权限) same bits, but different semantics from those of files r: can list directory contents w: can add or remove files from a directory x: can enter a directory especially, when the "w" bit is set, anyone 阅读全文
posted @ 2013-04-23 22:35 robotke1 阅读(371) 评论(0) 推荐(0)
摘要: 转载http://blog.csdn.net/xabc3000/article/details/6823639查看默认的一些参数,注意core file size是个0,程序出错时不会产生core文件了。# ulimit -acore file size (blocks, -c) 0data seg size (kbytes, -d) unlimitedfile size (blocks, -f) unlimitedmax locked memory (kbytes, -l) 4max memory size (kbytes, -m) unlimitedopen files (-n) 2048 阅读全文
posted @ 2013-04-23 22:25 robotke1 阅读(2422) 评论(0) 推荐(0)
摘要: 转载http://blog.csdn.net/li_yang98/article/details/3261211使用C/C++语言开发程序时,当程序crash的时候产生core dump文件对于调试程序是很有帮助的。在Redhat Linux系统中默认是不生成core dump文件的,这是因为在/etc/profile文件中有这样一行 ulimit -S -c 0 > /dev/null 2>&1如何打开core dump呢?最简单的方法是用户在自己的~/.bash_profile中加入ulimit -S -c unlimited > /dev/null 2>& 阅读全文
posted @ 2013-04-23 21:52 robotke1 阅读(626) 评论(0) 推荐(0)
摘要: 1 #include <iostream> 2 #include <string> 3 #include <vector> 4 #include <fstream> 5 #include <sstream> 6 7 using namespace std; 8 9 string int2str(int number)10 {11 string strNumber;12 int result = abs(number); 13 14 if (r... 阅读全文
posted @ 2013-04-23 18:39 robotke1 阅读(844) 评论(0) 推荐(0)
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <error.h> 5 #include <sys/types.h> 6 #include <sys/stat.h> 7 #include <unistd.h> 8 9 /*10 Linux终端输入提示符下输入命令:man 2 stat11 12 stat, fstat, lstat - get file status13 14 有点类似于exec函数族一样的, 阅读全文
posted @ 2013-04-23 17:28 robotke1 阅读(420) 评论(0) 推荐(0)
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <error.h> 5 6 /* 7 FILE *fopen(const char *filename, const char *mode); 8 int fclose(FILE *stream); 9 10 size_t fread(void *buffer, size_t size, size_t count, FILE *stream);11 size_t fwrite(const void 阅读全文
posted @ 2013-04-23 16:53 robotke1 阅读(286) 评论(0) 推荐(0)
摘要: 转载http://www.cnblogs.com/hongzg1982/archive/2010/04/14/1711964.htmlfopen()函数fopen ( string filename, string mode )返回值是 FILE*fopen() 中的 mode 的可能值列表 mode说明'r'只读方式打开,将文件指针指向文件头。'r+'读写方式打开,将文件指针指向文件头。'w'写入方式打开,将文件指针指向文件头并将文件大小截为零。如果文件不存在则尝试创建之。'w+'读写方式打开,将文件指针指向文件头并将文件大小截 阅读全文
posted @ 2013-04-23 16:40 robotke1 阅读(381) 评论(0) 推荐(0)
摘要: 1 #include <iostream> 2 #include <string> 3 #include <vector> 4 #include <fstream> 5 #include <sstream> 6 7 using namespace std; 8 9 template<typename T>10 void toString(T element)11 {12 ostringstream oss;13 oss << element;14 string str(oss.str());15 16 cout 阅读全文
posted @ 2013-04-23 15:33 robotke1 阅读(759) 评论(0) 推荐(0)
摘要: 1 #include <iostream> 2 #include <string> 3 #include <vector> 4 #include <fstream> 5 #include <sstream> 6 7 using namespace std; 8 9 void readFile1(void) 10 { 11 ifstream ifs("test.txt"); 12 if (!ifs) 13 {cout << "File open error!" << end 阅读全文
posted @ 2013-04-23 15:07 robotke1 阅读(1491) 评论(0) 推荐(0)
摘要: 1 #include <iostream> 2 #include <string> 3 #include <vector> 4 #include <fstream> 5 6 using namespace std; 7 8 int main(int argc, char *argv[]) 9 {10 ifstream ifs("test.txt");11 12 ifs.seekg(0, ios::end); //设置文件指针到文件流的尾部13 streampos pos = ifs.tellg(); //读取文件指针的位置14 阅读全文
posted @ 2013-04-23 13:37 robotke1 阅读(888) 评论(0) 推荐(0)
摘要: View Code 1 #include <iostream> 2 #include <string> 3 #include <vector> 4 #include <fstream> 5 6 using namespace std; 7 8 int main(int argc, char *argv[]) 9 {10 int iArray[] = {23, 45, 57, 68, 23, 46, 68};11 vector<int> iVec(iArray, iArray + sizeof(iArray) / sizeof(*iAr 阅读全文
posted @ 2013-04-23 12:02 robotke1 阅读(4135) 评论(0) 推荐(0)
摘要: 1 ostringstream oss; 2 string city("ZhuHai"); 3 string name("Robot"); 4 string phoneNumber("10086"); 5 6 oss << city << " "; 7 cout << oss.str() << endl; // 输出ZhuHai 8 oss << name << " "; 9 cout << oss.str() 阅读全文
posted @ 2013-04-23 11:39 robotke1 阅读(427) 评论(0) 推荐(0)