Fecoly的博客
Fecoly · 共 9 篇文章
C 获得随机数
#include using namespace std; time_t temp_time; srand((unsigned)time(&temp_time));//初始化随机种子 int r = (rand() % 256); //0-255 int r1 = (rand() % 10); //0-9 int r2 = (rand() % 100); //0-99
2012-08-19T14:59:03Z · 编程语言 · 评论(0)
c 获得毫秒
Linux系统 使用gettimeofday接口:gettimeofday能得到微秒数,比毫秒还要更精确。 #include <stdio.h> #include <sys/time.h> int main() { struct timeval start, end; gettimeofday( &start, NULL ); sleep(3); gettimeofday( &end, NULL ); int timeuse = 1000000 * ( end.tv_sec - start.tv_sec ) + end.tv_usec - start.tv_usec; printf("tim…
2012-08-15T22:24:18Z · 编程语言 · 评论(0)
无法连接到linux虚拟机
解决方法: 一、开启SSH 以root用户登录Linux,打开终端,运行: /etc/init.d/sshd restrat 二、关闭防火墙 1.在终端运行 setup 2,.选择 firewall 回车 3.按tab键切换到disablede项,然后按空格键选择,然后再按tab键切换到ok,按空格件选择 4.按tab键切换到quit,按空格件选择 然后用客户端ssh登录Linux 三、关闭防火墙的另一种方式 /etc/init.d/iptables stop 补充: 红旗linux的某些版本,不允许root用户远程登陆的,需要修改设置#vi /etc/ssh/sshd_config 中 P…
2012-07-20T23:23:18Z · 操作系统 · 评论(0)
C++ 创建文件夹
//C++创建文件夹 bool CreateFolder(string path) { char* fileName = (char*)path.c_str(); char* tag; for(tag = fileName; *tag; tag++) { if ('\\' == *tag || '/' == *tag) { char buf; char path; strcpy(buf, fileName); buf = '\0'; strcpy(path, buf); if (access(path, 6) == -1) //第二个参数 00:检测是否存在 02:写权限 04:读权限 06…
2012-06-28T22:15:51Z · 编程语言 · 评论(0)
资源连接
android系统自带system/app下载 http://download.csdn.net/download/lin2221021/3551265 Android在Git上的所有项目源码下载 http://www.linuxidc.com/Linux/2011-03/33518.htm windows下安装git下载android源码 http://blog.csdn.net/fengkuanghun/article/details/7073389
2012-03-24T08:17:01Z · 研发管理 · 评论(0)
java反射
public void gets(Class clazz) throws Exception { Object e=clazz.newInstance(); //实例化对象 // 获取字段 java.lang.reflect.Field fies = clazz.getDeclaredFields(); // 获得全部字段 java.lang.reflect.Field pubFies = clazz.getFields(); // 获得全部公有字段 System.out.println("全部字段个数:" + fies.length + "\n公有字段个数:" + pubFies.leng…
2011-08-03T14:40:00Z · 编程语言 · 评论(0)