自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

飘--的博客

C 嵌入式linux

  • 博客(27)
  • 收藏
  • 关注

转载 创建守护进程:先建立守护进程,在守护进程建立一个子进程,该子进程暂停10s,然后退出,并由该守护进程收集子进程退出的消息。子进程,守护进程的退出消息都在/var/log/message中输出,子进程退

#include #include #include #include #include #include #include #include #define MAXFILE 65535int main(void){pid_t child1,child2;int i,len,fd;char *buf="This is a dameon

2016-08-09 20:50:44 1977

转载 1.写多进程,一个父进程,两个子进程,一个运行ls –l, 另一个暂停5s,父进程先阻塞等待第一个子进程的结束,然后用非阻塞等另一个进程退出,收集到第二个子进程结束的信息,父进程就返回。

#include#include#include#include#includeint main(){pid_t child1, child2, father;//child2=fork();child1=fork();if(child1 {printf("child1 is error\n");exit(1);

2016-08-09 20:49:31 5130 1

转载 线性表链式存储

#include "stdio.h"    #include "string.h"#include "ctype.h"      #include "stdlib.h"   #include "io.h"  #include "math.h"  #include "time.h"#define OK

2016-08-08 20:56:47 224

转载 链队列

#include "stdio.h"    #include "stdlib.h"   #include "io.h"  #include "math.h"  #include "time.h"#define OK 1#define ERROR 0#define TRUE 1#defin

2016-08-08 20:55:34 232

转载 顺序队列

#include "stdio.h"    #include "stdlib.h"   #include "io.h"  #include "math.h"  #include "time.h"#define OK 1#define ERROR 0#define TRUE 1#defin

2016-08-08 20:54:56 192

转载 链栈参考

#include "stdio.h"    #include "stdlib.h"   #include "io.h"  #include "math.h"  #include "time.h"#define OK 1#define ERROR 0#define TRUE 1#defin

2016-08-08 20:54:12 136

转载 顺序栈参考

#include "stdio.h"    #include "stdlib.h"   #include "io.h"  #include "math.h"  #include "time.h"#define OK 1#define ERROR 0#define TRUE 1#defin

2016-08-08 20:53:27 207

转载 单链表的参考1

#include#include#include#include#include#include////////////////////////////////////////////////////////////////////////////////////////////////////////////#define len size

2016-08-08 20:52:46 165

原创 文件的读取

#include#include#include#include#includeint main(){int fd, len;char buff[100];char *buf="i love china";fd=open("helo1.c",O_RDWR|O_CREAT);if(fd{printf("open is error\n")

2016-08-08 20:49:02 208

转载 文件的复制

#include #include #include #include #define BUFFER_SIZE 1024 int main(int argc,char **argv) { FILE *from_fd;FILE *to_fd; long file_len=0;char buffer[BUFFER_SIZE]; char *ptr; 

2016-08-08 20:47:08 199

原创 打开目录,读取目录 ,然后获得文件状态

#include#include#include#include#include#include#include#include#includestatic int get_stat(const char *filename){struct stat statbuf;if(stat(filename,&statbuf)==-1){

2016-08-08 20:43:03 275

原创 c语言通讯录2.0

#include#include#include#include#include#include#define len sizeof(struct tongxunlu)#define error 0struct tongxunlu{char name[20];int tel;char addr[20];struct tongxun

2016-08-08 20:40:18 245

转载 wei 老师的 文件复制

#include #include #include #include #define BUFFER_SIZE 1024 int main(int argc,char **argv) { FILE *from_fd;FILE *to_fd; long file_len=0;char buffer[BUFFER_SIZE]; char *ptr; 

2016-08-03 20:20:20 354

原创 文件的创建于读取

1 #include  2   3   4 int main()  5 {  6     FILE *fp;  7     char str[20];  8     int num;  9  10     fp=fopen("hello2.c","a+");                         //打开一个文件,没有则创建 11     if(f

2016-08-03 19:58:43 189

原创 简单通讯录

#include#include#include#define len sizeof(struct tongxunlu)#define error 0struct tongxunlu{char name[20];int tel;char addr[20];struct tongxunlu *next;};typedef str

2016-07-29 17:08:47 297

转载 wei 老师写的链表(参考)

#include #include #include struct Node{    int data;    struct Node *next;};typedef struct Node   LinkList;#define LEN  si

2016-07-29 17:07:43 299

原创 链表的增删改查(带头节点)

#include#include#include#define len sizeof(struct student)#define ERROR  0#define ok    1struct student{    int num;//    float score;    struct student *next;};typ

2016-07-29 17:06:36 393

原创 ⑴输入10个职工的姓名和职工号;⑵按职工号由小到大排序,姓名顺序也随之调整;⑶要求输入一个职工号,查找法找出该职工的姓名。从主函数输入要查找的职工号,输出该职工姓名

1 #include  2 #include  3 #include  4   5 #define len sizeof(struct student)  6 #define n 3  7   8 struct student  9 { 10     char name[20]; 11     int num; 12     struct student

2016-07-27 17:47:54 6216

原创 链表的动态输入、插入 、与删除

1 #include  2 #include  3 #include  4   5 #define len sizeof(struct student)  6   7   8 struct student  9 { 10     int num; 11     float score; 12     struct student *next; 13

2016-07-27 17:44:34 1616

原创 字符串复制注意问题

#includeint main(){   char a[10];   char b[]="abcdefg";   int i;   for(i=0; b[i]!='\0'; i++ )   {     a[i]=b[i];   }   a[i]='\0';              //字符串的复制需要加结束符,不然会乱码   

2016-07-25 20:08:12 309

原创 关于计算结构体数组中字节数

2.结构体计算长度,如下: #include #include struct student{  int num;  char name[20];  char sex;  float score;  }; main(){struct student stu_1, *p;    printf("steudent len is %d\

2016-07-24 20:37:48 3918

原创 malloc函数动态分配内存单元的用法

1 #include  2   3 int main()  4 {  5   6     int *p;  7     p=(int *) malloc(1024);  8     *p=3;  9  10     printf("p address is%p\n",p); 11     printf("*p is%d\n",*p); 12  13

2016-07-24 19:19:43 1973

原创 通过链表来输出各个结构体中的数据

1 #include  2 #include  3   4 struct stu  5 {  6     int num;  7     char name[100];  8     int score;  9     struct stu *next; 10 }; 11  12 int main() 13 { 14     struct stu

2016-07-24 19:15:54 1427

原创 用C语言查询某个人的投票数

1 #include  2 #include  3   4 struct a  5 {  6     char name[100];  7     int count;  8 }b[4]={"zhang", 0,"li",0,"wang",0,"sun",0};  9  10 int main() 11 { 12     char c[100]; 1

2016-07-24 19:10:57 473

转载 查找某个字符在一个字符串中的位置,假设字符串中的字符是有序的,如“adfgikmnprs”中查找g的位置。(折半查找)

#includeint main(){char a[12]={'a','b','f','g','i','k','m','n','p','r','s'};int mid;char c;scanf("%c",&c);int lower=0,upper=10;while(lower{mid=(lower+upper)/2;if(c==a[mid])

2016-07-23 16:55:53 522

原创 用冒泡法和选择法对10个学生成绩进行排名

1. 冒泡法#includeint main(){   int a[10];   int i=0, t, j;      printf("please write 10 stu_grade:");    for(i=0; i    scanf("%d",&a[i]);    printf("\n");         for(j=0; j

2016-07-23 16:55:05 2972

原创 在一个字符串中插入指定字符

1.添加一个中间变量进行数据的转移:#include#includeint main(){char a[]="character";    char b='z';int i, k;    char tmp;    int n=strlen(a);printf("input a zifu at:");scanf("%d",&k);

2016-07-23 16:51:49 2959

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除