04 2012 档案

java.net.SocketException: Address family not supported by protocol
摘要:java.net.SocketException: Address family not supported by protocolandroid 应用程序连接时间服务器失败,不影响应用程序,可以忽略 阅读全文

posted @ 2012-04-29 13:51 wps712 阅读(1017) 评论(0) 推荐(0)

C语言常用函数
摘要:atoi 头文件: #include <stdlib.h> 功 能: 把字符串转换成整型数. 名字来源:array to integer 的缩写. 原型: int atoi(const char *nptr); 函数说明: 参数nptr字符串,如果第一个非空格字符不存在或者不是数字也不是正负号则返回零,否则开始做类型转换,之后检测到非数字(包括结束符 \0) 字符时停止转换,返回整型数。 阅读全文

posted @ 2012-04-27 21:28 wps712 阅读(161) 评论(0) 推荐(0)

linux下模块与模块间,模块与内核间共享变量
摘要:Linux symbol export method:[1] If we want export the symbol in a module, just use the EXPORT_SYMBOL(xxxx) in the C or H file. And compile the module by adding the compile flag -DEXPORT_SYMTAB. Then we can use the xxxx in the other module.[2] If we want export some symbol in Kernel that is not in a m 阅读全文

posted @ 2012-04-27 21:06 wps712 阅读(809) 评论(0) 推荐(0)

程序中有游离的...
摘要:编写linux内核实验时,出现——“程序中有游离的‘\200’”错误,原因在于输入法不同,切换到英文输入法重新输入,可得到正确结果。一般在复制代码时遇到这种问题。 阅读全文

posted @ 2012-04-25 19:40 wps712 阅读(647) 评论(0) 推荐(0)

fgets与fscanf读入一行
摘要:char *fgets(char *s, int n, FILE *stream);int fscanf(FILE *stream, char *format,[argument...]);fgets读入最后的\n,而fscanf不读入。所以在获得字符串长度是,int len = strlen(s)-1;//fgets对人的或者int len = strlen(s);//fscanf 读入的 阅读全文

posted @ 2012-04-22 12:03 wps712 阅读(3785) 评论(0) 推荐(0)

linux互斥操作——信号量
摘要:简单的互斥操作:#include<stdio.h>#include<unistd.h>#include<stdlib.h>#include<stdlib.h>#include<sys/types.h>#include <sys/ipc.h>#include<sys/sem.h>int p(int sem_id){ struct sembuf sb; sb.sem_num=0; sb.sem_op=-1; sb.sem_flg=SEM_UNDO; if(semop(sem_id,&sb,1)==-1) r 阅读全文

posted @ 2012-04-18 22:48 wps712 阅读(269) 评论(0) 推荐(0)

android模拟器SD卡使用
摘要:1、启动命令行(Win+R,输入cmd),进入android SDK中tools目录下,(cd 目录名)2、创建sd卡映像,输入》 mksdcard 2048M sdcard.img (大小为2G)3、为模拟器选择sd卡:打开Android SDK and AVD Manager,选择对应模拟器,Edit,在SD Card中选File,选择刚建立的 sdcard.img4、用android调试工具adb管理文件:(adb在tools文件夹或platform-tools文件夹下),进入,运行:adb push 文件名 /sdcard5、打开模拟器,在Dev Tools 里 Media Scann 阅读全文

posted @ 2012-04-15 18:59 wps712 阅读(258) 评论(0) 推荐(0)

自己写的shell程序 多层管道、重定向、后台、命令历史
摘要:#include<stdio.h>#include<stdlib.h>#include<unistd.h>#include<fcntl.h>#include<string.h>#include<stdbool.h>#include<signal.h>#include <readline/readline.h>#include <readline/history.h>//#include<errno.h>//#include<sys/stat.h>#define M 阅读全文

posted @ 2012-04-14 18:45 wps712 阅读(664) 评论(0) 推荐(0)

键盘上键的ASCII码
摘要:字母 A 到 Z 和标准数字 0 到 9A(65) B(66) C(67) D(68) E(69) F(70) G(71) H(72) I(73) J(74) K(75) L(76) M(77) N(78) O(79) P(80) Q(81) R(82) S(83) T(84) U (85) V(86) W(87) X(88) Y(89) Z(90) 0(48) 1(49) 2(50) 3(51) 4(52) 5(53) 6(54) 7(55) 8(56) 9(57) 数字键盘上的键数字键盘0(96) 数字键盘1(97) 数字键盘2(98) 数字键盘3(99) 数字键盘4(100) 数字键盘5 阅读全文

posted @ 2012-04-14 10:19 wps712 阅读(4409) 评论(0) 推荐(0)

实现类似于shell中按“向上”,“向下”箭头的功能————readline库
摘要:[转载] 正确编译使用readline库The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in. Both Emacs and vi editing modes are available. The Readline library includes additional functions to maintain a list of previously-entered com 阅读全文

posted @ 2012-04-14 09:58 wps712 阅读(1280) 评论(0) 推荐(0)

open创建文件后,再读取出现Permission denied错误
摘要:函数 open(char *pathname, int flag, mode_t mode),当flag 指定有O_CREAT并忽略mode参数,在下次打开文件时,可能会提示没有权限之 类的错误原因:这样创建的文件权限是随机的,如果要指定创建的文件权限,就需要填写 mode 参数,这个参数是指定文件权限的,文件的权限分3组9位(rwx rwx rwx--对应用户,用户所在组,其它用户), mode 的值用4位表示,为3每组权限的和值。另外还有一个 umask 函数,这个函数是权限屏蔽,和 mode值 正好相反。 阅读全文

posted @ 2012-04-14 00:53 wps712 阅读(2434) 评论(0) 推荐(0)

C语言:void swap(int &a, int &b);出错
摘要:C中只有取地址符,没有引用类型。C++开始引入引用。 阅读全文

posted @ 2012-04-13 20:04 wps712 阅读(375) 评论(0) 推荐(0)

open与fopen 文件描述符与文件指针
摘要:首先说一下文件描述符与文件指针区别:文件描述符:在linux系统中打开文件就会获得文件描述符,它是个很小的正整数。每个进程在PCB(Process Control Block)中保存着一份文件描述符表,文件描述符就是这个表的索引,每个表项都有一个指向已打开文件的指针。文件指针:C语言中使用文件指针做为I/O的句柄。文件指针指向进程用户区中的一个被称为FILE结构的数据结构。FILE结构包括一个缓冲区和一 个文件描述符。而文件描述符是文件描述符表的一个索引,因此从某种意义上说文件指针就是句柄的句柄(在Windows系统上,文件描述符被称作文件句 柄)。open和fopen的区别:open返回一个 阅读全文

posted @ 2012-04-13 19:33 wps712 阅读(2952) 评论(0) 推荐(0)

ubuntu下编译工具 lex yacc安装
摘要:sudo apt-get install lex yacc出现unable to locate package lex yaccubuntu使用flex和bison来代替lex和yaccsudo apt-get install flex biso 阅读全文

posted @ 2012-04-09 14:20 wps712 阅读(4519) 评论(0) 推荐(0)

apt-get常用命令
摘要:一,什么的是apt-get高级包装工具(英语:Advanced Packaging Tools,简称:APT)是Debian及其衍生发行版(如:ubuntu)的软件包管理器。APT可以自动下载,配置,安装二进制或者源代码格式的软 件包,因此简化了 Unix系统上管理软件的过程,apt-get命令一般需要root权限执行,所以一般跟着sudo命令。二,apt-get中文参数用法:apt-get [选项] 命令 apt-get [选项] install|remove pkg1 [pkg2 ...]apt-get [选项] source pkg1 [pkg2 ...]apt-get 是一个下载安装软 阅读全文

posted @ 2012-04-09 14:14 wps712 阅读(61038) 评论(0) 推荐(9)

C语言sscanf()的用法
摘要:C语言sscanf()的用法sscanf() - 从一个字符串中读进与指定格式相符的数据. 函数原型: int sscanf( string str, string fmt, mixed var1, mixed var2 ... ); int scanf( const char *format [,argument]... ); 说明: sscanf与scanf类似,都是用于输入的,只是后者以屏幕(stdin)为输入源,前者以固定字符串为输入源。 其中的format可以是一个或多个 {%[*] [width] [{h | l | I64 | L}]type | ' ' | &# 阅读全文

posted @ 2012-04-08 09:49 wps712 阅读(342) 评论(0) 推荐(0)

导航