嵌入式
文章平均质量分 62
小灰灰看月亮
这个作者很懒,什么都没留下…
展开
-
linux 课堂作业
linux下文件拷贝代码#include #include #include #include #include #include #define BUFF_SIZE 1024int main(int argc,char *argv[]){ int from_fp; int to_fp; char b转载 2016-11-02 21:55:51 · 219 阅读 · 0 评论 -
文件操作二
#include #define SIZE 1024int main(){ FILE *fp = fopen("1.ppt", "ab+");if (fp == NULL){perror ("fopen");return -1;}FILE *fp1 = fopen("2.ppt", "ab+");if (fp1 == NULL){原创 2017-08-09 20:03:55 · 241 阅读 · 0 评论 -
linux中的文件操作代码一
fopen():#include int main(){ FILE *fp = fopen ("abc","ab+");//ab+加入b字符告诉函数库打开的文件为二进制文件而非纯文本文件! if (fp == NULL) { perror ("fopen"); return -1; }原创 2017-08-09 19:39:47 · 304 阅读 · 0 评论 -
只在堆上或是栈上分配对象的方法:
那么如何限制类对象只能在堆或者栈上建立呢?下面分别进行讨论。1、只能在堆上分配类对象,就是不能静态建立类对象,即不能直接调用类的构造函数。容易想到将构造函数设为私有。在构造函数私有之后,无法在类外部调用构造函数来构造类对象,只能使用new运算符来建立对象。然而,前面已经说过,new运算符的执行过程分为两步,C++提供new运算符的重载,其实是只允许重载operator new()函转载 2017-06-22 15:59:02 · 635 阅读 · 0 评论 -
关于字节对齐的理解
结构体对齐 有的时候,在脑海中停顿了很久的“显而易见”的东西,其实根本上就是错误的。就拿下面的问题来看: struct T { char ch; int i ; }; 使用sizeof(T),将得到什么样的答案呢?要是以前,想都不用想,在32位机中,int是4个字节,char是1个字节,所以T一共转载 2017-07-10 19:50:44 · 545 阅读 · 0 评论 -
TCP循环服务器 代码tcpser
#include #include #include #include #include #include #include #include #define PORT 1234int main(){int sockfd, newfd;struct sockaddr_in serv_addr;struct sockad原创 2016-12-26 22:21:57 · 440 阅读 · 0 评论 -
tcp_client
#include #include #include #include #include #include #include #include #define portnumber 3333int main(int argc, char *argv[]) { int sockfd; char buffer[1024];原创 2016-12-26 22:20:41 · 375 阅读 · 0 评论 -
链表插入删除
原创 2016-11-27 22:15:44 · 203 阅读 · 0 评论 -
C语言指针笔记
char *ptr;定一个指针,没有赋值,用NULL。char *ptr = NULL 即表示指向空,不能再做赋值,不能对0地址操作访问。 //#define NULL (void *)o如果出现段错误,看看对NULL有没有赋值。 如何避免野指针而不是杜绝:1.如果没有对指针进行赋值,可把指针指向空,可避免野指针2.如果出现段转载 2016-11-01 21:02:27 · 213 阅读 · 0 评论 -
续:Linux 系统命令
名称:expr 使用权限:所有使用者 ### 字串长度 shell>>expr length "this is a test" 14 ### 数字商数 shell>>expr 14 % 9 5 ### 从位置处抓取字串 shell>>expr substr "this is a test" 3 5 is i转载 2016-10-29 22:23:44 · 254 阅读 · 0 评论 -
续:linux系统命令大全
名称:crontab 使用权限:所有使用者 使用方式: crontab [ -uuser ] filecrontab [ -u user ] { -l | -r | -e } 说明: crontab 是用来让使用者在固定时间或固定间隔执行程式之用,换句话说,也就是类似使用者的时程表。-u user 是指设定指定 user 的时程表,这个前提是你必须要有其权限(比转载 2016-10-28 21:09:57 · 237 阅读 · 0 评论 -
Linux 系统命令及其使用详解(上)
名称:cat 使用权限:所有使用者 使用方式:cat[-AbeEnstTuv] [--help] [--version] fileName 说明:把档案串连接后传到基本输出(萤幕或加 > fileName 到另一个档案) 参数: -n 或 --number 由 1 开始对所有输出的行数编号 -b 或 --number-nonblank 和 -n 相似转载 2016-10-27 21:25:33 · 178 阅读 · 0 评论 -
续:嵌入式linux命令环节
一、目录部分:1、cd+(目录)~~进入目录2、cd..~~返回上一级3、cd~ ~返回特殊目录4、cd / ~ 根目录5、cd home6、gedit hello.c~相对路径(不能指定唯一的文件)7、gedit /root/hello.c~~~绝对路径(唯一)8、mkdir+(目录名)~创建目录9、rm -原创 2016-10-25 18:56:15 · 273 阅读 · 0 评论 -
嵌入式上课记录
1、C语言之父------丹尼斯.里奇2、Unix与linux的关系:两者都遵循posix标准(跨平台,实现兼容性),linux是开源、免费。3、Linux的特点:GPL协议(你下载的开源软件做出修改后,必须要开源出来)。 GNU(is not Unix)工具软件只能在Linux下使用4、[root @192.168原创 2016-10-24 16:24:29 · 220 阅读 · 0 评论 -
嵌入式开发
一、嵌入式的开发特点:引入了操作系统。二、嵌入式是在已有的操作平台上移植操作系统。三、传统开发的缺点:1、软件移植性变差。2、软件开发人员必须懂硬件知识。四、操作系统的优点:1、提供了丰富的网络协议栈2、提供了开源软件和工具以及开发库。3、提供了多任务制进程》4、提高了软件移植性5、为开发人员节约了时间,提高了开发效率。五、linux的操作系统:Vxworks、win ce、lin原创 2016-10-23 23:33:53 · 443 阅读 · 0 评论 -
用tcp协议创建一个服务器
#include #include #include #include #include #include #define PORT 9999int main(){ //1、创建socket int listen_socket = socket(AF_INET, SOCK_STREAM, 0); if (listen_socket == -1) { perro原创 2017-08-15 20:21:47 · 372 阅读 · 0 评论