linux c
文章平均质量分 50
左岸小贼
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
lseek
#include #include #include #include #define FILE_MODE S_IRUSR|S_IWUSR|S_IRGRP|S_IROTHchar buf1[] = "abcdefghij";char buf2[] = "ABCDEFGHIJ";int main(void){ pid_t fd;原创 2012-07-08 13:17:23 · 465 阅读 · 0 评论 -
sizeof与strlen
#include #include #include void main(){ char *str = "123456"; char str2[10]="123456"; printf("sizeof char is %d\n",sizeof(char)); printf("sizeof char* is %d\n",sizeof(cha原创 2012-07-05 21:53:11 · 364 阅读 · 0 评论 -
进程fork
fork()在 Linux 系统库 unistd.h 中的函数声明如下:pid_t fork(void);程序:forktest.c #include #include main(){ pid_t pid; printf("Now only one process\n"); printf("Calling fork...\n");原创 2012-07-05 21:38:44 · 258 阅读 · 0 评论 -
函数指针 结构体struct
#include typedef int (*func_t)();typedef struct sop{ int num1; int num2; func_t op;}opnum;int add(int num1,int num2){ return(num1 + num2);}int sub(int num1,int原创 2012-07-07 23:51:24 · 430 阅读 · 0 评论 -
求字符串长度的实现
#include #include int strlen_t(char *str){ int i = 0; while(*(str+i)!='\0') i++; return i;}#ifdef DEBUGvoid main(int argc,char* argv[]){ char st[] =原创 2012-07-05 22:34:07 · 319 阅读 · 0 评论 -
vim配置
1:查看vim配置文件 cat /usr/share/vim/vimrc sudo gvim /etc/vim/vimrc.local添加一下内容: set nuset hlsset incsearchset showmatchset matchtime=5" 自动格式化 set formatoptions=tcrqn " 继承前一行的缩进方原创 2013-08-15 15:23:12 · 505 阅读 · 0 评论 -
union int内存类型存储情况
#include union mem{ int num; char byte[4];};void main(){ int i; union mem n; n.num = 0x12345678; printf("num is %0x\n",n.num); printf("In memory is原创 2012-07-05 21:41:16 · 390 阅读 · 0 评论 -
字符串指针 整形指针
字符串指针#include #include #include void tmp(char *str){ printf("2222 %p,%p\n",&str,str); str = "123456"; printf("3333 %p,%p\n",&str,str);}void main(){ char *a=ma原创 2012-07-05 22:07:24 · 377 阅读 · 0 评论 -
字符串常量引起的思考
源地址:http://www.cnblogs.com/-Lei/archive/2013/01/12/2858027.html记得以前看过一道这样的题目: 以下程序的执行结果是?#include int main(){ cha转载 2013-11-11 15:58:12 · 653 阅读 · 0 评论 -
系统调用exec
fork()只能建立相同程序的副本Linux 还提供了系统调用 exec 系列,它可以用于新程序的运行。exec 系列中的系统调用都完成相同的功能,它们把一个新程序装入调用进程的内存空间,来改变调用进程的执行代码,从而形成新进程。如果 exec 调用成功,调用进程将被覆盖,然后从新程序的入口开始执行。这样就产生了一个新的进程,但是它的进程标识符与调用进程相同。这就是说,exec 没有建立一个与原创 2012-07-05 21:38:00 · 2553 阅读 · 0 评论
分享