
Linux
文章平均质量分 59
ustcqi
这个作者很懒,什么都没留下…
展开
-
Linux程序设计之创建静态库
Linux程序设计之创建静态库 今天终于把那本Linux程序设计买了,没想到书店的价格比网上还要便宜,好开心额^ 创建静态库 1.创建函数的源文件,此处为print.c #include void printInt(int n) { printf("%d\n", n); } void printStr(char *arg) { printf("%s原创 2012-10-10 20:40:18 · 569 阅读 · 0 评论 -
栈在内存中的存储管理
•Register %esp indicates lowest stack address-address of top element原创 2012-12-27 21:11:50 · 609 阅读 · 0 评论 -
VIM键盘图
原创 2013-01-04 09:54:51 · 1387 阅读 · 0 评论 -
第五章标准IO流
标准IO流1.流和FILE对象 在第三章中(文件IO),所有的I/O函数都是针对文件描述符的,当打开一个文件时,即返回一个文件描述符.然后该文件描述符就用于后续的I/O操作.而对于标准I/O库,他们的操作则是围绕流(stream)进行的.当用标准I/O库打开或创建一个文件时,我们已使一个流与一个文件相关联. (1)对于国际字符集,一个字符可用多个字节表示,标准I/O文件流可用于单字原创 2013-01-09 15:35:19 · 613 阅读 · 0 评论 -
函数单独编译与函数在main函数中调用编译后生成汇编代码对比
前几天上信息安全课,简单的把课上内容复习下.主要讲单个函数编译后生成汇编代码地址 与 函数在main函数中调用后生成汇编地址的区别int accum = 0;int sum(int x, int y){ int t = x + y; accum += t; return t;}code.c文件代码如上所示,输入命令gcc -o1 -c c原创 2012-12-03 20:23:45 · 1054 阅读 · 0 评论 -
如何写makefile
作一个好的和professional的程序员,makefile还是要懂。特别在Unix下的软件编译,你就不能不自己写makefile了,会不会写makefile,从一个侧面说明了一个人是否具备完成大型工程的能力。 因为,makefile关系到了整个工程的编译规则。一个工程中的源文件不计数,其按类型、功能、模块分别放在若干个目录中,makefile定义了一系列的规则来指定,哪些文件需要先编译转载 2013-01-05 20:48:04 · 533 阅读 · 0 评论 -
The first regex
木有讲解,直接上代码#include#includeint main(){ regex_t regex; const size_t nmatch = 1; char *buf = "sa612336@gmail.com"; const char *pattern = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*.\\w+([-.]\原创 2013-01-11 00:10:46 · 482 阅读 · 0 评论 -
gdb文档
gdb(1) GNU Tools gdb(1)NAME gdb - The GNU DebuggerSYNOPSIS gdb [-help] [-nx] [-q] [-batch] [-cd=dir] [-f] [-b bps] [-t转载 2013-04-24 21:24:36 · 2674 阅读 · 0 评论 -
常用的gdb调试命令
小结:常用的gdb命令 backtrace 显示程序中的当前位置和表示如何到达当前位置的栈跟踪(同义词:where) breakpoint 在程序中设置一个断点 cd 改变当前工作目录 clear 删除刚才停止处的断点 commands 命中断点时,列出将要执行的命令 continu转载 2013-04-24 20:59:47 · 2419 阅读 · 0 评论 -
第一个makefile
网络程序设计,上周的上周就讲makefile了,由于一直在复习考试,就木有搞工程实践,今天把makefile弄了.创建一个print.h文件, 并声明print()函数#ifndef _PRINT_H#define _PRINT_H#includevoid print();#endif#include"print.h"void print(){原创 2012-12-22 09:08:39 · 817 阅读 · 0 评论 -
网络程序设计-第一个socket程序
网络程序设计开课了,写了个socket,目前还不完善,先贴出来,改进后再改服务器端代码如下:#include#include #include#include#include#include#include#include#define SERVER_PORT 8080#define BUFFER_SIZE 255 /*1.socket2.connec原创 2012-11-22 20:10:40 · 944 阅读 · 2 评论 -
Linux-shell初学(一)
今天看shell编程,顺手发到博客吧#!/bin/sh# first# this file looks through all the files in the current dirctory for the string posix, and then prints the names of those files to # the standard output.for fil原创 2012-10-19 21:14:44 · 526 阅读 · 0 评论 -
linux 获取日期及系统时间
看linux程序设计的第四章-时间和日期,看到这个程序,感觉有点用,发到博客吧,不过有点小问题,运行时tm_hour的结果不正确,有待检查 #include#include#includeint main(){ struct tm *tm_ptr; time_t the_time; (void)time(&the_time); tm_ptr = g原创 2012-11-03 19:25:50 · 800 阅读 · 0 评论 -
linux-C实现查看目录中所有文件
买了本Advanced Programming in the UNIX Environment,感觉不错,不愧被称为圣经,最近一段时间可能要看它了,写了地一个程序,查看目录的所有文件 #include#includeint main(int argc, char *argv[]){ DIR *dir; struct dirent *dirp; if(ar原创 2012-11-21 15:11:45 · 1424 阅读 · 0 评论 -
ls 命令结果重定向
直接截图比较直观原创 2012-11-21 15:26:31 · 2705 阅读 · 0 评论 -
一个简单的模拟shell的程序
#include#include#include#include#include#include#define MAXLINE 1024int main(){ char buf[MAXLINE]; pid_t pid; int status; printf("%%"); while( fgets(buf, MAXLINE, stdin)原创 2012-11-21 16:10:55 · 1309 阅读 · 0 评论 -
linux程序和进程入门了解
程序存放在磁盘上,存储在某个磁盘上的可执行文件,使用6个exec函数中的一个由内核将进程读入存储器. UNIX为每个进程分配一个唯一的数字标识,称为进车个ID,进程ID总是非负数. #include#include#includeint main(){ int pid = getpid(); printf("the process of this prog原创 2012-11-21 15:44:25 · 545 阅读 · 0 评论 -
测试本机操作系统的字节序
看APUE的网络编程部分,讲解字节序时发现自己总是忘记大端法和小端法,总是记混,写了个程序,num = 0x01234567;如果0x67对应的地址是小地址即为小端法,否则为大端法 见程序:#includeint main(){ int i = 0; int num = 0x01234567; char *p = (char *)&a; printf(原创 2012-11-21 19:47:30 · 1100 阅读 · 0 评论 -
C语言编译过程详解(转载)
预处理(Pre-Processing)-->编译(Compiling)-->汇编(Assembling)-->链接(Linking) 1、预处理器 根据以字符#开头的命令(directives),修改原始的C程序 这个阶段并不会去检查代码的错误,只会把#的语句转成C代码# gcc -E hello.c -o hello.i 2、编译阶段在这个阶段中,Gcc首先要转载 2012-11-22 09:09:00 · 784 阅读 · 0 评论 -
Linux C下实现线程池
下面是原文链接,我是照着敲的。。。hi.baidu.com/boahegcrmdghots/item/f3ca1a3c2d47fcc52e8ec2e1#include#include#include#include#include#include/*线程池里所有运行和等待的任务都是一个thread_job由于所有任务都在链表中,所以是一个链表结构*/typedef str原创 2013-04-17 16:21:33 · 2581 阅读 · 1 评论