2013年7月9日

Ubuntu下gdb远程调试--warning: Could not load vsyscall page because no executable was specified解决方案

摘要: 1. 首先安装gdbserverapt-get install gdbserver2. 编译-g 程序gcc -g test_gdb.c -o test_gdb源码如下:#include "Util.h"void p1(){ int j = 0; char *p; *p = '5'; printf("%p %c",p,*p); do { j++; }while(j This is free software: you are free to change and redistribute it.There is NO WARRA... 阅读全文

posted @ 2013-07-09 17:24 净坛使者 阅读(2624) 评论(0) 推荐(0) 编辑

2013年7月5日

Fedora 16设置开机自启动程序与Ubuntu的区别

摘要: Ubuntu设置开机自启动脚本的方法是:修改/etc/init.d/rc.local这个文件,添加需要启动的程序即可,相关函数如下:void SetSysAutoBoot(){ char path[256] = {0}; int ret = 0; ret = readlink("/proc/self/exe",path,sizeof(path)); if((ret > 0 )&& (ret > /etc/init.d/rc.local\n",path); printf(buf); system(buf); } free(b... 阅读全文

posted @ 2013-07-05 11:28 净坛使者 阅读(1585) 评论(0) 推荐(0) 编辑

2013年6月28日

使用sem_post信号量进行线程同步

摘要: 写了一小段程序,测试一下线程同步的问题,如下:#include #include #include #include #include #include sem_t sp; int val = -1;int semPost(sem_t * pSem, int nMaxCount){ int nRet, nSemCount; sem_getvalue(pSem, &nSemCount); if (nSemCount>=nMaxCount) { return 0; } else { nRet=sem_post(pSem); ... 阅读全文

posted @ 2013-06-28 15:01 净坛使者 阅读(974) 评论(0) 推荐(0) 编辑

2013年6月26日

git 和 svn的区别(转)

摘要: 英文原文:5 Fundamental differences between GIT & SVN,编译:外刊IT评论如果你在读这篇文章,说明你跟大多数开发者一样对GIT感兴趣,如果你还没有机会来试一试GIT,我想现在你就要了解它了。GIT不仅仅是个版本控制系统,它也是个内容管理系统(CMS),工作管理系统等。如果你是一个具有使用SVN背景的人,你需要做一定的思想转换,来适应GIT提供的一些概念和特征。所以,这篇文章的主要目的就是通过介绍GIT能做什么、它和SVN在深层次上究竟有什么不同来帮助你认识它。那好,这就开始吧…1.GIT是分布式的,SVN不是:这是GIT和其它非分布式的版本控制 阅读全文

posted @ 2013-06-26 10:18 净坛使者 阅读(300) 评论(0) 推荐(0) 编辑

2013年6月25日

Ubuntu下实用命令收集 --新增 删除 环境变量

摘要: 1. 关闭防火墙:sudo ufw disable2. 设置IPV4地址和网关:ifconfig eth0 up %s netmask %sroute del default gw 192.168.110.1 eth0route add default gw %s eth03. 设置IPV6地址和网关:ip -6 addr add %s/%s dev eth0ip -6 route add ::/0 via %s dev eth0 //特别是这一条,网上很多都是写错的,只有这个是可以通过三层VLAN跨网段ping通的。正确的网址:http://ipv6.xjtu.edu.cn/conf/lin 阅读全文

posted @ 2013-06-25 12:35 净坛使者 阅读(743) 评论(0) 推荐(0) 编辑

2013年6月20日

数据结构(C语言版)---第三章栈和队列 3.4.2 队列的链式表示和实现(循环队列)

摘要: 这个是循环队列的实现,至于串及数组这两章,等有空再看,下面将学习树。源码如下:#include #include #define MAXQSIZE 8typedef int QElemType ;typedef struct{ QElemType *base; int front; int rear;}SqQueue;int InitSqQueue(SqQueue *S){ S->base = (QElemType *)malloc(sizeof(QElemType)*MAXQSIZE); printf("Init %p\n",S->base); if(!S.. 阅读全文

posted @ 2013-06-20 12:07 净坛使者 阅读(690) 评论(0) 推荐(0) 编辑

2013年6月19日

数据结构(C语言版)---第三章栈和队列 3.4.2 队列的链式表示和实现(单链表)

摘要: 只是实现了简单的算法,了解队列的FIFO,源码如下:#include <stdio.h>#include <stdlib.h>typedef int QElemType ;typedef short Status;typedef struct QNode{ QElemType data; struct QNode * next;}QNode,*QueuePtr;typedef struct { QueuePtr front; QueuePtr rear;}LinkQueue;Status InitQueue(LinkQueue *Q){ Q->front = Q- 阅读全文

posted @ 2013-06-19 16:52 净坛使者 阅读(408) 评论(0) 推荐(0) 编辑

2013年6月14日

数据结构(C语言版)---第三章栈和队列 3.3 表达式求值

摘要: 主要是参照“算法优先法”改写的。如何判断两个算术运算符之间的优先关系值得借鉴。源码如下:Main_3_3_EvaluateExpression.c#include "Stack_char.h"#include "Stack_float.h"#define OPSETSIZE 7unsigned char Prior[7][7] = { // ±í3.1 Ëã·û¼äµÄÓÅÏȹØÏ&# 阅读全文

posted @ 2013-06-14 15:46 净坛使者 阅读(672) 评论(0) 推荐(0) 编辑

逻辑运算的结果与逻辑运算中判断变量是否为真的区别

摘要: C语言编译系统在表示 逻辑运算 的 结果 时, 以数值 1 表示 “真” , 以数值 0 表示 “假”。但在 判断 一个量是否为“真”时,以 0 代表 “假”,以非0代表“真”。例程:#include <stdio.h>void Print(int value){ if(value) { printf(" %d is true !!!\n",value); } else { printf(" %d is false !!!\n",value); }}int main(int argc, char **argv){ ... 阅读全文

posted @ 2013-06-14 15:38 净坛使者 阅读(709) 评论(0) 推荐(0) 编辑

2013年6月13日

数据结构(C语言版)---第三章栈和队列 3.2.4 迷宫求解

摘要: 花了一下午时间,完成了纯C语言版的迷宫求解,源码见下:Main_3_2_maze.c:#include "Stack_maze.h"#define ROW 10#define LINE 10Cell c[LINE][ROW];void InitCell(){ int i = 0 ; int j = 0; for(i = 0 ; i < LINE ; i++) { for(j = 0 ; j < ROW ; j++) { c[i][j].pix.x = i; c[i][j].pix.y = j; ... 阅读全文

posted @ 2013-06-13 12:45 净坛使者 阅读(460) 评论(0) 推荐(0) 编辑

导航