![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
linux
yangshuolll
这个作者很懒,什么都没留下…
展开
-
实现ssh免密登录linux服务器
1. 使用ssh-keygen生成公钥和私钥2. 将公钥上传到服务器,私钥保留在本地 ( scp /path/filename username@servername:/path/ 通过命令上传本地文件到服务器 或者通过 Xshell 的sz 和 rz 命令进行图片上传和下载操作)3. 可以使用 cat id_rsa.pub >> authorized_keys 将公钥...原创 2019-02-20 19:39:19 · 199 阅读 · 0 评论 -
linux下access函数的使用
access就是来判断文件的执行权限的函数。原创 2014-04-09 23:34:40 · 1740 阅读 · 0 评论 -
linux 下 opendir 和 readdir 函数的应用
#include #include #include #include #include #include void printall(const char *path, int max){ DIR *dir = opendir(path); if (dir == NULL){ return ; } struct dirent *dirent原创 2014-04-09 23:21:13 · 1164 阅读 · 0 评论 -
生成日期类 使头文件和实现文件分离
写一个日期类 有三个参数的构造函数 默认值 是2014年5月8日。要求可以显示日期 还可以 设置日期 日期的默认值是 2014年1月1日 。 还要求 头文件 和实现文件分离。原创 2014-05-09 00:24:59 · 1023 阅读 · 0 评论 -
数据结构 二叉树的实现 c语言版
只有三个点的二叉树,完成他的查找操作和打印操作。二叉树如图所示:下面附上二叉树的代码:#include struct node;// 代表的是方块typedef struct tree{ struct node *p_node;}tree;// 代表的是圆圈typedef struct node{ int num; tree left;原创 2014-03-27 00:00:04 · 1330 阅读 · 0 评论 -
多文件编程动态开辟空间来实现队列的操作 c语言版
用动态开辟的存储空间来实现队列的操作 满足先进先出的条件,可以从队列前面插入,后面移出。也可以从队列的前面移出,后面插入。本代码实现的是从队列的前面插入,后面移出。queue.h#ifndef __QUEUE_H__#define __QUEUE_H__void push(int number);int pop();int front();int empty();int f原创 2014-03-26 00:12:12 · 1052 阅读 · 0 评论 -
多文件编程链状结构实现栈的操作 c语言版
动态开辟存储空间模拟栈的操作:stack.c#include #include #include "stack.h"typedef struct node{ int num; struct node *p_next;}node;static node head,tail;void push(int number){ node *tmp = (n原创 2014-03-26 00:00:45 · 1068 阅读 · 0 评论 -
多文件编程动态开辟空间实现双向链表的应用 c++版
双向链表,在结构体中定义两个指针,一个指针指向前一个节点,另一个指向后一个节点。 然后动态的开辟空间来存储插入的数据。dqueue.h#ifndef __DQUEUE_H__#define __DQUEUE_H__void init();void deinit();int first();int last();void add_head(int num);void appen原创 2014-03-25 23:49:24 · 836 阅读 · 0 评论 -
简单的栈操作和多文件编程
stack.h 函数的声明#ifndef __STACK_H__#define __STACK_H__#define SIZE 10static int arr[SIZE];static int top;void init();void deinit();int full();int empty();void push(int num);int tp();int si原创 2014-03-25 00:23:14 · 957 阅读 · 0 评论 -
linux下通过调用fork函数实现多进程
#include #include #include #include int main(void){ pid_t pid = fork(); if(!pid){ printf("the id of Children is %d\n",getpid()); printf("the id of Parents is %d\n",getppid()); exit(0原创 2014-04-11 01:21:14 · 2041 阅读 · 0 评论 -
c++ 中 一个类变量 成为另一个类的成员的使用
定义两个类,一个base类和一个cylinder#includeusing namespace std;#define PI 3.1415926class Base{ double radius; public: Base(double r):radius(r){ } double area(){ return radius * radius * PI; }};原创 2014-05-17 16:10:40 · 4327 阅读 · 0 评论 -
关于类的指针的应用
类指针可以用来之下#include using namespace std;class Rectangle{ int height,width; public: Rectangle(int h,int w):height(h),width(w){ } int area(){ return height * width; }};int main(vo原创 2014-05-17 22:01:58 · 902 阅读 · 0 评论 -
微信支付HTTPS服务器证书更换问题 主机centos
今天在邮箱中看到这样一句话尊敬的微信支付商户:因微信支付HTTPS服务器证书的根CA证书将于2018年8月23日到期失效,微信支付计划于2018年5月29日更换服务器证书。新的服务器证书由权威机构(DigiCert) 签发, 如果你的服务器上没有部署DigiCert的根CA证书,将导致你的下单、退款等功能无法正常使用。请开发人员务必尽快完成证书验证及安装,详细流程可查看商户平台公告。微信...原创 2018-04-10 00:15:46 · 1490 阅读 · 3 评论 -
Ubuntu安装nodejs
Ubuntu 14.04自带的Node.js版本太老,且我试了下安装并不成功,所以需要添加Node.js PPA安装最新版的Node.js,在终端中执行: sudo add-apt-repository ppa:chris-lea/node.jssudo apt-get updatesudo apt-get install nodejsnod原创 2017-06-15 14:55:28 · 296 阅读 · 0 评论 -
拷贝linux系统镜像
因为需要给16台机子安装linux镜像并且配置一系列相同的软件。所以需要将一台机子安装后liunx镜像和指定的软件,然后将linux镜像拷贝到其他的16台机子上。下面是操作流程。准备两个U盘,一个安装Clonezilla(再生龙)引导系统,另一个存储生成的linux镜像。首先将要拷贝镜像的主机上运行再生龙引导系统。然后参考顺序,按照该文章链接,拷贝linux镜像。并将linux镜像原创 2017-05-18 23:08:30 · 2776 阅读 · 0 评论 -
解决ssh无法连接服务器问题,ssh上传和下载文件详解
ssh无法连接服务器,只能通过服务器提供商提供的web端tty连接到服务器,然后执行相关的命令。首先先将ssh服务器删除sudo apt-get remove openssh-client openssh-server然后再重新安装sudo apt-get remove openssh-client openssh-server这时候发现ssh可以连接到服务器上了,原创 2017-04-20 17:52:22 · 6696 阅读 · 1 评论 -
聊天室客户端应用程序
#include #include #include #include #include #include #include #include #include #include #include //定义全局的socket文件描述符int sockfd;//初始化socketvoid init();//启动客户端void start();// 销毁客户端vo原创 2014-04-29 01:22:11 · 1305 阅读 · 0 评论 -
局域网ip扫描器c语言多线程 linux版
原理: 采用多线程的方式实现ping命令,原创 2014-04-27 16:35:08 · 5064 阅读 · 0 评论 -
C/C++ 在网络下的编程的应用(时间同步器)
写一个基于UDP的时间服务器。 时间服务器提供的功能就是: 当客户端发送请求时,发回当前的系统时间。时间服务器要写成死循环,用信号退出。 提示:系统时间找 time() 获得秒差,函数localtime()负责把秒差转成 年月日小时分秒的格式,返回给客户端。localtime()返回时间的结构体指针 struct tm,具体成员 在localtime的手册中可以看到。简介: 采原创 2014-04-20 17:26:16 · 3940 阅读 · 0 评论 -
sbrk 和brk 函数使用举例
#include #include int main(){ int *p1,*p2,*p3,*p4,*p5,*p6; p1 = (int *)sbrk(sizeof(int));//Rxxx ---- ---- ---- *p1 = 1; printf("%d\n",*p1); printf("%p\n",p1); p2 = (int *)sbrk(sizeof(原创 2014-04-03 00:47:51 · 1500 阅读 · 0 评论 -
brk和sbrk的虚拟内存的管理
void *sbrk(int size)-size = 0 返回sbrk/brk 上次的末尾地址-size > 0 分配内存空间,返回上一次末尾地址-size int brk(void *ptr) -直接修改访问的有效范围的末尾地址 -释放空间形成一个完整的page,则该页映射被解除 - 返回 0 返回成功 -1 失败 注意: sbrk 是在开辟原创 2014-04-03 00:29:49 · 1039 阅读 · 0 评论 -
平衡二叉树的构建 用函数回调来扩展程序 c语言实现
构建平衡二叉树 6 3 8 1 4 10多文件编程实现tree.h#ifndef __TREE_H__#define __TREE_H__void init();vo原创 2014-03-28 00:32:57 · 965 阅读 · 0 评论 -
shell 命令案例
从控制台中读取参数,并输出出来#!/bin/bash #Programe 切换bash 表明shell脚本的编写目的# input data to the programe#History 注明编写时间和编写人 下面是将环境变量添加上去#2014/3/16 tomPATH=/bin:/sbin:/usr/bin原创 2014-03-16 23:46:54 · 961 阅读 · 1 评论 -
文件复制 c语言实现
文件复制,在linux中,将生成的read.o 重新文件拷贝一份复制到ReadCopy.o中,并且更改ReadCopy.o文件的操作权限。使其能够正常运行。#include int main(){ FILE *r_file = fopen ("read.o","rb"); FILE *w_file = fopen ("ReadCopy.o","w"); char temp[10];原创 2014-03-14 00:32:10 · 1304 阅读 · 0 评论 -
c++ 命名空间示例
c++ 命名空间的演示#include#include#includeusing namespace std;namespace guodh{ char name[] = "guodh"; void show() { cout<<" hai "<< name <<endl; }}namespace daniel { string name = "原创 2014-03-04 23:17:43 · 900 阅读 · 0 评论 -
linux 下vim 编辑器的使用
这4天接连使用vim编辑器,发现vim是自己的编写代码的效率提高很多 虽然没有自动补全的功能,但是在插入,复制,删除方面带来了巨大的提高。 下面我来做一下简单的vim编辑器快捷建的使用。建议可以才console prompt 中键入 vimtutor 在这个文本中练习vim快捷键的使用。下面是我对vim 快捷键的总结。(1)h,j,k,l represent l原创 2014-02-26 22:41:35 · 914 阅读 · 0 评论 -
百钱买百鸡问题
就是1 roster 5$ , 1 hen 3$ , 3 chickens 1$, 问如何百钱买百鸡。直接贴代码 不解释。#include// 1 roster 5 1 hen 3 3 chicken 1int main(){ int ros,hen,chi; for (ros = 0; ros <= 20; ros ++){ for ( hen原创 2014-02-26 22:59:09 · 996 阅读 · 0 评论 -
backTrack 基本操作命令学习
if interface 接口config 配置-a allifconfig -aifconfig -eth0ifconfig eth0 up //打开eth0 网卡接口ifconfig eth0 down //关闭eth0 网卡接口//重启网络关闭网络后可能会造成 network unreachable 所以要键入以下命令/etc/原创 2013-08-08 23:03:27 · 1440 阅读 · 0 评论 -
ubuntu中 编译c文件
linux 中编译C文件例如:hello.c一种编译方法:gcc hello.c 产生a.out 执行:./a.out二种编译方法:gcc -c hello.c 先生成目标文件hello.o gcc -o hello h转载 2013-02-06 00:33:54 · 849 阅读 · 0 评论 -
指针函数 的解释c语言
指针函数,主要是看最后的两个字,是函数但是他的返回值是一个指针。然后下面我就举一个指针函数的小例子。#include int *reverse(int *p,int size){ //将数组翻转 int i = 0; for (i = 0;i < size;i++){ *(p + i) = 0 - *(p + i); } return p;}int原创 2014-03-17 23:47:02 · 868 阅读 · 0 评论 -
指针的疑难解释
先上图make an example:int num = 1;int * p = #注释:-> 代表的意思4 -> num5 -> &num6-> *(&num) 即num变量存储的内容1 -> p2 -> &p 指针的地址3 -> *(&p) 指针p变量中所存储的内容下面做一个指针来遍历数组内容的演示:#include原创 2014-03-18 00:16:13 · 802 阅读 · 0 评论 -
排序算法和查找 例子详解
选择排序#includevoid select_sort(int data[],int size){ int i,j; for (i = 1;i < size; ++i){ int pos = i - 1; for(j = i - 1; j < size; ++j){ if(data[pos] > data[j]){ pos = j原创 2014-03-30 14:11:38 · 972 阅读 · 0 评论 -
在linux下关于socket函数的使用
socket 直译是插座意思,在网络上是套接字的使用。原创 2014-04-18 00:01:13 · 1524 阅读 · 0 评论 -
gdb调试工具的使用
突然发现gdb的调试工具还是蛮好用的,下面给大家介绍下gdb调试工具的基本使用方法要用gdb需要在用gcc编译源文件时加上 gcc -g main.c然后就可以直接调用gdb对生成的a.out文件进行调试了,可以调用出他的符号表和调试信息gdb a.out然后 l 是显示代码b 行号 是在此行号设置断点r restart 重新运行次函数s 跳原创 2014-04-02 01:00:00 · 1387 阅读 · 0 评论 -
linux下动态链接库的使用
(1)gcc -c -fpic add.c sub.c(2)gcc -shared add.c sub.c -o libmath.so(3)gcc main.c -ldl就可以产生动态链接的结果了让我写下使用动态链接库的几个函数吧void * dlopen(const char *filename, int flag);filename 是动态链接库的名字flag的值是原创 2014-04-02 00:43:19 · 802 阅读 · 0 评论 -
结构体和多文件编程
用结构体表示线段和点,然后调用函数来判断就是那条线段长度最长。来返回值。main.c#include #include "cal.h"int main(){ line one,two; int num = 0; printf("Please input the positon of two points to represent first line.\n");原创 2014-03-20 23:07:24 · 1147 阅读 · 0 评论 -
linux下构建静态库的方法
1.编写.c 和.h 文件我写了4个add.c#include "add.h"int add(int a,int b){ return a+b;}add.h#ifndef __ADD_H__#define __ADD_H__int add(int, int);#endifsub.c#include"sub.h"int sub(int a,i原创 2014-04-01 01:09:28 · 883 阅读 · 0 评论 -
库函数qsort的实现
实现全能的qsort,既能实现结构体排序,又能排int,double,等等错误的原因是没有考虑到自己定义的cmp函数的返回值是0 和1 main.c#include "qsort.h"int cmp(const void *p1, const void *p2){ return *(int *)p1 < *(int *)p2;}void show(int size,int a原创 2014-04-01 00:38:33 · 1017 阅读 · 0 评论 -
宏定义,条件预编译,多文件编程
宏定义的用法:#include#define PI 3.14#define CH(x) x='A'?tolower(x):toupper(x)#define C(x) #x#define INTV(n) i_##nint main(){ int num = 2; printf("%lf\n",num * num * PI); char ch = 'A';原创 2014-03-20 01:02:07 · 1249 阅读 · 0 评论 -
信息系统修改版 c语言 控制台版
用文件来存储用户储存的信息,整形的id,age和浮点型的salary 和字符串的名字并且对id来进行查重操作。 缺点是 文件的查重操作必须是上一次保存后信息存储文件有数据后才可以进行。保存文件的代码:#include #include #define Size 20int judge(int id){ FILE *p_judge = fopen("info.txt","rb")原创 2014-03-19 00:13:29 · 1477 阅读 · 2 评论