摘要:
1.dpkg 的使用 dpkg -s ssh 查看是否按装了ssh软件 dpkg -L ssh 查看ssh安装的关联目录结构和安装位置 dpkg -i vim.deb 本地离线安装vim编辑器 apt-get install vim 远程安装 dpkg -r vim 移除一个已安装的包裹。 dpkg
阅读全文
posted @ 2018-03-27 11:56
王默默
阅读(889)
推荐(0)
摘要:
indent工具,可以把代码格式化成某种风格。 通过命令:rpm -qa | grep indent 查看是否安装了indent工具。 若没有,可使用命令sudo apt-get install indent进行安装 使用命令 indent -kr -i8 main.c -kr选项表示K&;R风格,
阅读全文
posted @ 2018-03-27 11:33
王默默
阅读(1688)
推荐(0)
摘要:
rpm命令是RPM软件包的管理工具。rpm原本是Red Hat Linux发行版专门用来管理Linux各项套件的程序,由于它遵循GPL规则且功能强大方便,因而广受欢迎。逐渐受到其他发行版的采用。RPM套件管理方式的出现,让Linux易于安装,升级,间接提升了Linux的适用度。 语法 选项 参数 软
阅读全文
posted @ 2018-03-27 11:31
王默默
阅读(902)
推荐(0)
posted @ 2018-03-27 10:55
王默默
阅读(388)
推荐(0)
摘要:
要重启机器才行D:\Program Files (x86)\linux.iso解压tar zxvf VMwareTools-9.9.0-2304977.tar.gz
阅读全文
posted @ 2018-03-26 17:55
王默默
阅读(1288)
推荐(0)
摘要:
先创建目录结构 src bin obj lib include 1.创建命名空间 创建一个头文件include/head.h; 2.使用自定义名义空间 创建一个头文件src/main.cpp 3.用g++命令编译程序;生成可执行文件 放到 bin/hellword
阅读全文
posted @ 2018-03-25 14:40
王默默
阅读(245)
推荐(0)
摘要:
1 // HelloApp.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include 6 #include "head.h" 7 using namespace std; 8 9 10 int main() 11 { 12 int num=0; 13 cout > num; 15 co...
阅读全文
posted @ 2018-03-25 14:00
王默默
阅读(124)
推荐(0)
摘要:
1.make中建立的其他语言的规则 SCCS , RCS , ar, lex 和yacc 命令 2.为了建立一个目标,make会遍历一连串的依赖关系;这个是为 决定何处开始创建; 如果没有找到目标文件;make按照有限顺序查找源文件 3.了了生成目标文件,它首先查找带有(*.c,*.f或*.s)后缀
阅读全文
posted @ 2018-03-25 11:43
王默默
阅读(646)
推荐(0)
摘要:
命令行:make -f Makefile2 说明开始make一个名为Makefile2的文件 其中下面 目标:=依赖列表 都是变量定义 CC:=gccCFLAGS:=-IincludeCFLAGS+= -cTARGET:=bin/mymath_testDEPEND:=obj/mymath.oDEPE
阅读全文
posted @ 2018-03-25 11:16
王默默
阅读(426)
推荐(0)
摘要:
1.Makefile 的编写规则一 目标列表:关联性列表 命令列表 目标列表:可以是多个以空格隔开多个目标文件 关联列表页称为先决条件;同样是用个或多个空格分开的目标文件 命令列表:用《tab》字符开始的commond的清单! 2.Makefile规则二 目标列表:关联性列表:命令列表 该规则不建议
阅读全文
posted @ 2018-03-24 20:05
王默默
阅读(279)
推荐(0)
posted @ 2018-03-24 19:51
王默默
阅读(757)
推荐(0)
摘要:
1、共享库的概念 2、创建共享库命令 具体加不加 fpci 这个要看平台支持吧支持;具体详情可以查阅 shared的相关参数文档 这里有一个-fPIC参数PIC就是position independent codePIC使.so文件的代码段变为真正意义上的共享如果不加-fPIC,则加载.so文件的代
阅读全文
posted @ 2018-03-24 10:21
王默默
阅读(4069)
推荐(1)
摘要:
(一)静态库就是把一些*.o的文件集合起来;以*.a结尾打包;做成的lib库文件;专门放到lib目录下 静态库的制作: 1.制作*.a文件 把之前src/mymath.c 的源文件 编译成单独的o文件 gcc -o obj/mymath.o -Iinclude -c src/mymath.cgcc
阅读全文
posted @ 2018-03-24 08:39
王默默
阅读(1396)
推荐(0)
摘要:
安装ssh 打开"终端窗口",输入"sudo apt-get install openssh-server"-->回车-->输入"y"-->回车-->安装完成。 查看ssh服务是否启动 打开"终端窗口",输入"sudo ps -e | grep ssh"-->回车-->有sshd,说明ssh服务已经
阅读全文
posted @ 2018-03-23 14:12
王默默
阅读(4214)
推荐(0)
摘要:
sudo passwd 设置root密码 回车,回车,回车就完成了,然后 su root 切换root用户
阅读全文
posted @ 2018-03-23 14:02
王默默
阅读(2092)
推荐(0)
摘要:
设置虚拟机不能联网是很痛苦的,这里我就ubuntu的NAT上网问题就个人经验讲一下,其他的桥连接等没有使用就没有经验了。 1.查看/设置下NAT的网络 打开VMware Workstation, 点击编辑——虚拟网络编辑器,查看NAT模式的网络。 如下图示,如果你对自动分配的子网IP不喜欢的可以点击
阅读全文
posted @ 2018-03-23 13:53
王默默
阅读(21302)
推荐(0)
摘要:
概述—— 什么是makefile?或许很多Winodws的程序员都不知道这个东西,因为那些Windows的IDE都为你做了这个工作,但我觉得要作一个好的和professional的程序员,makefile还是要懂。这就好像现在有这么多的HTML的编辑器,但如果你想成为一个专业人士,你还是要了解HTM
阅读全文
posted @ 2018-03-23 11:48
王默默
阅读(240)
推荐(0)
摘要:
#include #include void text_to_bin(char *argv[]); void bin_to_text(); typedef struct { int xh; char name[20]; int age; }Student; int main(int a,char *argv[]){ if(a!=4){ printf("参数不够!\n");...
阅读全文
posted @ 2018-03-21 23:53
王默默
阅读(2191)
推荐(0)
摘要:
#include #include //功能: 合并2个源文件的内容,到一个新的文件中 int main(int a,char *argv[]){ if(a!=4){ printf("请输入3个文件路径:%s\n", argv[0]); exit(1); } FILE *fp1,*fp2,*fp3; fp1 = fopen(argv[1],"r"); if(fp1==NUL...
阅读全文
posted @ 2018-03-20 23:02
王默默
阅读(263)
推荐(0)
摘要:
#include #include #define IS_WHITE_SPACE(c) ((c)==' '||(c)=='\t'||(c)=='\n') ? 1:0 //统计文件:内容大小字节 和函数 int main(int a,char *argv[]){ if(a!=2){ printf("useage:%s source!\n", argv[0]); exit(1); ...
阅读全文
posted @ 2018-03-20 22:04
王默默
阅读(316)
推荐(0)
摘要:
#include #include //文件的内容复制 int main(int a,char *argv[]){ if(a!=3){ printf("useage:%s source!\n", argv[0]); exit(1); } FILE *fp1, *fp2; fp1 = fopen(argv[1],"r"); if(fp1==NULL){ prin...
阅读全文
posted @ 2018-03-20 21:54
王默默
阅读(503)
推荐(0)
摘要:
以CentOS为例,安装后是没有C语言和C++编译环境的,需要手动安装,最简单的是用yum的方式安装,过程如下: 1、安装gcc 询问是否,按y键回车即可,或者 不用确定全部就安装好了。 2、安装g++ 安装完毕。 只在CenOS 7.2下测试正常
阅读全文
posted @ 2018-03-19 22:55
王默默
阅读(15488)
推荐(0)
摘要:
#include #include "head.h" #define TRUE 1 #define FALSE 0 #if defined (TRUE) && !defined (FALSE) #error YOU NEED TO DEFINE FALSE... #elif defined (FALSE) && !defined (TRUE) #error you need to de...
阅读全文
posted @ 2018-03-18 22:22
王默默
阅读(341)
推荐(0)
摘要:
#include #include void out(int *p, int n){ int i; for(i=0;i<n;i++){ printf("%d ", *(p+i)); } printf("\n-------------------\n"); } int main(void){ printf("请输入要申请几块整型为4字节大小的块内存:"); int n; s...
阅读全文
posted @ 2018-03-18 10:58
王默默
阅读(1769)
推荐(0)
摘要:
#include #include void out(int *p, int n){ int i; for(i=0;i<n;i++){ printf("%d ", *(p+i)); } printf("\n-------------------\n"); } pr...
阅读全文
posted @ 2018-03-18 09:50
王默默
阅读(2174)
推荐(0)
摘要:
1.首先设置开关 设置 core文件的大小为1000K存放数据 [oracle@xweb1 clession]$ ulimit -c0[oracle@xweb1 clession]$ ulimit -c 1000 2. 编译-g调试程序如下 gcc -g -o bin/gdb_core src/gd
阅读全文
posted @ 2018-03-18 00:35
王默默
阅读(234)
推荐(0)
摘要:
1、下载GDB7.10.1安装包 2、解压 3、创建安装目录 4、配置安装 在刚才解压的目录文件内/opt/gdb-7.10.1 这个目录下;执行 5、编译 6、安装
阅读全文
posted @ 2018-03-17 17:11
王默默
阅读(1726)
推荐(0)
摘要:
#include #include int main(){ //字符数组的使用 char str[] = {'z','b','c','\0'}; //字符数组 printf("str地址:%p str[0]=%c str[0]地址:%p \n",str,str[0],&str[0]); printf("str地址:%p str[1]=%c str[1]地址:%p \n",str...
阅读全文
posted @ 2018-03-17 10:34
王默默
阅读(7997)
推荐(0)
摘要:
#include #include int main(){ char str[][30] = {"zhangsan","lisi","wangwu"}; char (*p)[30] = str; //定义行指针 printf("%p %p %p 行数:%d 列数:%d\n",str, &str[0], &str[0][0], sizeof(str)/sizeof(str[0]),siz...
阅读全文
posted @ 2018-03-16 23:57
王默默
阅读(3804)
推荐(0)
摘要:
#include #include int main(){ int a = 100; void *p = &a; printf("a:%d address:%p\n",*(int*)p, &a); //unsigned int *pt = (unsigned int*)0xbfa70ee8; int *pt = (int*)malloc(sizeof(int)); *pt = 2...
阅读全文
posted @ 2018-03-16 23:11
王默默
阅读(2924)
推荐(0)
摘要:
#include int main(void){ void *p; int a = 14322; char c ='A'; p = &a; //p = &c; //强制类型转换(int*)p 把变量指针p强制转换成指向int类型的指针 printf("a=%d\n",*(int*...
阅读全文
posted @ 2018-03-16 17:51
王默默
阅读(7528)
推荐(0)
摘要:
共用体:共享同一个内存;一旦a使用了b就被弃用 b使用a就被弃用!
阅读全文
posted @ 2018-03-15 22:17
王默默
阅读(2328)
推荐(0)
摘要:
#include #include struct tells;//声明结构体 struct info { char *infos; }; typedef struct Books { char *name; int page; struct info *pinfo; struct tells *tel; }BK; struct tells{ char *age; }; void ...
阅读全文
posted @ 2018-03-14 22:12
王默默
阅读(12169)
推荐(1)
摘要:
int *p = (int *)malloc(sizeof(int)) malloc函数会返回开辟空间的首地址,加(int *)的目的是让计算机知道,如何去划分这个开辟的空间, 因为char、int 、long这些类型的字节大小是不一样的,我们知道了首地址, 还要知道是以几个字节为单元。 所以,这句
阅读全文
posted @ 2018-03-14 18:12
王默默
阅读(16329)
推荐(0)
摘要:
一、光标的移动0: 移动到行首。$: 移动到行尾。w: walk移动到下一个单词b: back 移动到上一个单词h或退格: 左移一个字符;后退l或空格: 右移一个字符;前进j: 下移一行;k: 上移一行; shift + g: 移动到页尾 gg:移动到页头开始位置 二、翻屏ctrl+f: 下翻一屏。
阅读全文
posted @ 2018-03-14 15:58
王默默
阅读(370)
推荐(0)
摘要:
#include #include struct Books { char title[50]; //char author[100]; //int book_id; }; int main(){ struct Books b1; strcpy(b1.title,"C语言"); struct Books *p1; p1 = &b1; strcpy(p1->title,"Ja...
阅读全文
posted @ 2018-03-14 10:07
王默默
阅读(546)
推荐(0)
摘要:
//定时器 #include #include #include int main(int num, char* arg[]){ //arg数组存放指针 //printf("个数:%d 参数值1:%s 参数值2:%s 参数值:%s\n",num,arg[0],arg[1],arg[2]); if(num!=2){ printf("必须输入一个数字:%s\n",arg[0]); ...
阅读全文
posted @ 2018-03-13 12:44
王默默
阅读(8852)
推荐(0)
摘要:
1:指针数组:就是这个数组里面的元素全部是指针;即地址 如: int a[] = {1,2,3,4,5}; int *p[] = {&a[0],&a[1],&a[2],&a[3],&a[4]};//全部元素都是地址 2:数组指针: 指向数组的指针叫数组指针 int (*p)[4]; //数组指针也就
阅读全文
posted @ 2018-03-10 20:26
王默默
阅读(526)
推荐(0)
摘要:
1.使用函数指针数组来实现计算器 2.通过函数指针变量来调用对应的函数
阅读全文
posted @ 2018-03-10 19:19
王默默
阅读(10951)
推荐(0)
摘要:
从上面来看;add函数参数入栈顺序 从左到右LInux 和Windows不一样 进一步发现,Pascal语言不支持可变长参数,而C语言支持这种特色,正是这个原因使得C语言函数参数入栈顺序为从右至左。 具体原因为:C方式参数入栈顺序(从右至左)的好处就是可以动态变化参数个数。 通过栈堆分析可知,自左向
阅读全文
posted @ 2018-03-10 16:51
王默默
阅读(653)
推荐(0)