上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 30 下一页

2017年10月25日

C语言文件操作

摘要: 下列代码创建一个a.txt文件,权限777,fp为返回码 #include<stdio.h> #include<fcntl.h> int main(){ int fp; fp=open("a.txt",O_CREAT,777); printf("%d\n",fp); close(fp); retur 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(228) 评论(0) 推荐(0)

c的动态内存管理

摘要: 在linux系统下使用malloc提示警告,解决方法,加入头文件<stdlib.h> 首先来个基本的例子 int *p=(int *)malloc(sizeof(int));(当malloc无法分配内存时会返回null,所以在使用它返回的指针前最好先检查null是否为空,如果不为空再使用p指针) * 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(122) 评论(0) 推荐(0)

Linux I/O状态实时监控iostat

摘要: 首先查看系统有没有安装sysstat 如果没有,则yum install sysstat -y [root@bogon ~]# iostat -c 2 2 #显示cpu状态信息 Linux 3.10.0-514.el7.x86_64 (bogon) 06/25/2017 _x86_64_ (1 CP 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(113) 评论(0) 推荐(0)

Linux查看CPU信息

摘要: 我的cpu为i3310m 适用类型:笔记本 CPU系列:酷睿i3 3代系列 CPU主频:2.4GHz 三级缓存:3MB 插槽类型:FCBGA1023,FCPGA988 封装大小:37.5×37.5mm(rPGA988B),....>> 核心数量:双核心 线程数:四线程 #/proc/cpuinfo是 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(154) 评论(0) 推荐(0)

一不小心把win10的秘钥卸载了解决方法

摘要: 我遇到的第一个问题是Win10家庭版激活失败提示错误代码0xC004C003 然后我百度后看到一个解决方法是卸载秘钥然后再输入秘钥的,于是我执行了slmgr.vbs /upk,发现win10秘钥被卸载了,可是再输入网上那个秘钥报错。再看win10激活状态,发现产品ID不可用。最后在百度贴吧看到一个回 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(3647) 评论(0) 推荐(0)

Windows系统如何设置定时锁屏

摘要: 貌似很久没写程序了,随便用C语言实现吧 #include<stdio.h> #include<stdlib.h> int main(){ system("rundll32.exe user32.dll,LockWorkStation"); return 0; } 编译链接生成exe可执行文件 进入控 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(588) 评论(0) 推荐(0)

C语言指针入门

摘要: 指针指包含地址 声明指针: int num;声明整数 int *num;声明指针,下面的声明也是等价的,空格的使用指示个人爱好 int* num; int * num; int *num; int*num; 阅读声明: const int *pci; 倒过来读比较好看,pci是个指针变量,pci是个 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(310) 评论(0) 推荐(0)

getpwnam,getgrnam,getpwent,crypt等函数

摘要: [root@bogon code]# cat a.c #include<stdio.h> #include<pwd.h> int main() { struct passwd *pw;//定义指针pw记录返回值 pw=getpwnam("root"); printf("%s %s %d %d %s 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(728) 评论(0) 推荐(0)

输出内容时后面显示乱码

摘要: 使用文件操作函数时,我遇到过几次,打印内容时内容没有错误,可是末尾多显示了几个乱码,其实主要是因为字符串末尾没有赋字符串结束符号\0 [root@bogon mycode]# cat a.c #include<stdio.h> #include<fcntl.h> #include<unistd.h> 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(210) 评论(0) 推荐(0)

将Linux文件清空的几种方法

摘要: 1、使用重定向的方法 [root@centos7 ~]# du -h test.txt 4.0K test.txt [root@centos7 ~]# > test.txt [root@centos7 ~]# du -h test.txt 0 test.txt 2、使用true命令重定向清空文件 [ 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(532) 评论(0) 推荐(0)

readv与writev

摘要: [root@bogon mycode]# cat writev.c #include<stdio.h> #include<string.h> #include<unistd.h> #include<sys/uio.h> int main() { char *str1="linux\n"; char 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(353) 评论(0) 推荐(0)

pread和pwrite函数

摘要: 先来介绍pread函数 [root@bogon mycode]# cat test.c #include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<fcntl.h> char buf[20]; void testpread(int 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(510) 评论(0) 推荐(0)

使用C语言简单模拟Linux的cat程序

摘要: 先给出源码 //fileio.c #include<stdio.h> #include<stdlib.h> #include<fcntl.h> void print(int fd) { int i,len; char buf[10]; len=read(fd,buf,10);//len是成功读入的字 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(316) 评论(0) 推荐(0)

linux运维面试题

摘要: 解释下什么是GPL,GNU,自由软件? GPL:(通用公共许可证):一种授权,任何人有权取得、修改、重新发布自由软件的权力。 GNU:(革奴计划):目标是创建一套完全自由、开放的的操作系统。 自由软件:是一种可以不受限制地自由使用、复制、研究、修改和分发的软件。主要许可证有GPL和BSD许可证两种。 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(155) 评论(0) 推荐(0)

/dev/null简单入门

摘要: 2>&1 /dev/null 将标准输入输出全部丢弃(表示2的输出重定向等同于1) 2>filename 把错误信息保存到filename 2>/dev/null >/dev/null 把错误信息丢弃,并别把标准输出也丢弃 cat /dev/null >a.txt 直接把a.txt内容清空 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(158) 评论(0) 推荐(0)

linux30道运维面试题

摘要: 传送门https://zhangge.net/1986.html 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(149) 评论(0) 推荐(0)

xencenter创建快照和恢复快照

摘要: 创建快照 恢复快照 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(1103) 评论(0) 推荐(0)

Xencenter如何安装Centos7虚拟机系统

摘要: xencenter的ip地址192.168.245.134(win10系统) 首先我们在win10系统安装好xencenter(这个软件可以直接在xenserver启动后,通过访问xenserver的ip,里面会有xencenter的安装包) 例如我们需要在在xenserver里面安装一个cento 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(2151) 评论(0) 推荐(0)

linux后台运行之&和nohup区别,模拟后台守护进程

摘要: 先来看一下&的使用 root@BP:~# cat test.sh #!/bin/bash while true do echo "linux">/dev/null done root@BP:~# ./test.sh & #&后台运行 [1] 4599 root@BP:~# ps #test.sh运行 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(672) 评论(0) 推荐(0)

linux磁盘检测和修复

摘要: 显示磁盘和闪存的信息,以及分区信息 [root@bogon shell]# fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sect 阅读全文

posted @ 2017-10-25 18:06 标配的小号 阅读(414) 评论(0) 推荐(0)

上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 30 下一页

导航