
▷ Linux
文章平均质量分 62
yss28
这个作者很懒,什么都没留下…
展开
-
pthread线程
主线程是特殊的当c语言运行时,首先执行main函数,这个特殊的执行流被称为“主线程”。主线程的特殊性在于Pthreads在main函数返回阶段保留了传统UNIX进程行为。即当进程结束时,所有线程、状态和它们的工作结果都会简单的“蒸发”——没有理由要清理什么。在大多数系统中,主线程运行在默认进程堆栈上,该堆栈可以增长到足够的尺寸;而在某些系统中,普通线程的堆栈空间是受限的,如果线程堆栈溢出,则程序会因原创 2017-01-05 14:04:40 · 548 阅读 · 0 评论 -
GCC预处理程序规则
/* 限定只有在定义了__unix__的情况下才能成功编译 */#ifndef __unix__#error "This section will only work on UNIX systems"#endif/* 插入指定的文件 */#include <errno.h>#include <stdio.h>#include <stdlib.h>/* 两值中的最小值 */#define原创 2017-02-22 17:14:25 · 555 阅读 · 0 评论 -
同步和异步例子(linux)
同步alarm.c#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>int main(int argc, char *argv[]) { int seconds; char line[128]; char message[64]; while (1) {原创 2017-01-04 20:08:55 · 2744 阅读 · 1 评论 -
字符串:多字节与宽字节转换
头文件#include <stdlib.h> mbstowcs 多字节字符串转换为宽字符串 wcstombs 宽字符串转换为多字节字符串使用注意对于 mbstowcs 函数来说,它需要知道多字节的编码类型才能正确的将其转换成宽字节的 unicode,很可惜这个编码类型并没有体现在函数的参数列表里,而是隐含依赖全局的 locale 。更加不幸的是,全局 locale 默认没有使用系统当前语言,原创 2016-11-23 14:41:38 · 3782 阅读 · 2 评论 -
Raspberry Pi 3安装配置Raspbian过程(2)
10. Samba服务器–共享文件移除已安装不兼容依赖包 apt-get remove samba-common apt-get remove libwbclient0 安装Samba apt-get install samba sudo smbpasswd -a ssyang #新增ssyang用户并设置密码配置文件(/etc/samba/smb.conf)[global]原创 2016-07-22 17:07:44 · 2893 阅读 · 0 评论 -
Raspberry Pi 3安装配置Raspbian过程
1. 前期准备 硬件Raspberry Pi 3主板5V 1A安卓充电器及数据线Samsung 64GB UHS-1 Class10 TF存储卡TF卡读卡器网线HDMI高清线(可无)支持HDMI输入的显示器(可无) 软件Win32DiskImager-0.9.5-install.exeAdvanced IP Scanner v2.4 2526 for Windows(无HDMI线原创 2016-07-11 00:29:14 · 38570 阅读 · 0 评论 -
Linux常用命令
功能 命令 关机 shutdown -h now 或者 poweroff 或者 init 0 重启 reboot 注销原创 2016-07-17 03:07:36 · 848 阅读 · 0 评论 -
GDB调试技巧
工具程序gdb是GNU调试器。为了能调试程序,编译时必须指定GCC的-g选项将源码与可执行代码联系起来。将程序载入调试器fibonacci.cint current;int next;int nextnext;void setstart(void) { current = 0; next = 1;}void calcnext(void) { nex原创 2017-12-12 12:32:07 · 1127 阅读 · 0 评论