Linux C 开发环境(debian)
#apt-get install gcc (编译器)
#apt-get install gdb (调试)
#apt-get install libc6-dev (开发库)
如果没有开发库,gcc的时候就会错误
gcc h.c
h.c: In function ‘main’:
h.c:1: warning: incompatible implicit declaration of built-in function ‘printf ’
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
安装后就没有问题了:
gcc h.c
h.c: In function ‘main’:
h.c:1: warning: incompatible implicit declaration of built-in function ‘printf
gcc -o hello hello.c
hello.c: In function ‘main’:
hello.c:2: warning: incompatible implicit declaration of built-in function ‘printf’
james@debian:~$ ls
a.out h.c hello hello.c
james@debian:~$ ./hello
Hello Linux
james@debian:~$
相关文档:
①malloc函数
原型:extern void *malloc(unsigned int num_bytes);
头文件:#include <alloc.h>
功能:分配长度为num_bytes字节的内存块。
说明:如果分配成功则返回指向被分配内存的指针,否则返回空指针NULL。当内存不再使用时,应使用free()函数将内存块释放。
举例:
#inclu ......
linux目录架构
/ 根目录
/bin 常用的命令 binary file 的目錄
/boot 存放系统启动时必须读取的档案,包括核心 (kernel) 在内
/boot/grub/menu.lst GRUB设置
/boot/vmlinuz 内核
& ......
Linux
中用
rdate
实现时间自动同步
原文地址:http://liuxh6.itpub.net/post/528/451628
在各种
linux
中都有
rdate
命令,只是一般很少有人 ......
#include <stdio.h>
#include <stdlib.h> //use malloc, free
#include <string.h> //use memset
#include <ctype.h> //use isdigit
#define ERROR_ILLEGAL_CHAR 1 //define error illegal character as 1
#define ERROR_NUMBERS_DIF 2 //define error numbers is not the same in diffe ......
1、从N个数中选出n个最大的数,写出思路和实现。
先读入n个,并且排序,队列,就是有序的队列。然后再一个个读,比最大的那个大的时候就FIFO。
2、写出一个c/s通讯程序,要求服务器端用非阻塞模式。
不让抄书?不让上网?直接拽一句“你Y当我man文档啊?”
3、TCP/UDP的异同。
确认机制,不知道还要问什么, ......