`
文章列表
#include "apue.h" #include <sys/wait.h> int main(void) { char buf[MAXLINE];//from apue.h pid_t pid; int status; printf("%% ");//print prompt while(fgets(buf,MAXLINE,stdin)!=NULL){ if(buf[strlen(buf)-1]=='\n') buf[strlen(buf)-1]=0;//replace newline w ...
#include "apue.h" int main(void) { printf("hello world from process ID %d\n",getpid()); exit(0); }  编译: gcc -o pid pid.c 运行: ./pid 得结果: hello world from process ID 6367 说明: 第一次运行时,此数字(6367)可能在不同的机器上都不同。 第二次运行时,得结果 hello world from pro ...
我的操作系统是ubuntu8.10,可以在网上找到安装qt编译环境的安装方法。现简略叙述如下: (1)sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos qt4-designer 此命令安装了五个软件。        qt4-dev-tools是qt开发的一 ...
#include "apue.h" int main(void) { int c; while((c=getc(stdin))!=EOF) if(putc(c,stdout)==EOF) err_sys("output error!"); if(ferror(stdin)) err_sys("input error!"); exit(0); }    我将上面这个程序命名为getchar.c。    编译:             gcc -o getchar get ...
#include "apue.h" #define BUFFSIZE 4096 int main(void) { int n; char buf[BUFFSIZE]; while((n=read(STDIN_FILENO,buf,BUFFSIZE))>0) if(write(STDOUT_FILENO,buf,n)!=n) err_sys("write error!"); if(n<0) err_sys("read er ...
     本人的所用操作系统是ubuntu8.10。      开始学习《unix环境高级编程》,编译第一个例子就出现了问题:              myls.c:1:19: apue.h: No such file or directory              myls.c: In function `main':             ...
    ARM的学习。有了单片机或计算机结构的基本知识、c语言的基础,上手ARM是比较容易的。学习ARM,首先应当 了解一下ARM的体系结构,了解它有哪些版本、哪些模式、哪些寄存器、异常等。这方面的内容可以参考《ARM体系结构与编程》一书,这本书介绍的内容比较全,可以先快速浏览,特别是一些汇编指令不需要记住,以后开发时可以参考相关的手册。其次选定一种具体厂家型号的ARM处理器,学习该处理器相关的开发工具的使用,如开发环境、仿真器及评估板等。然后可以分析该处理器的外围扩展方法,如SDRAM、NAND Flash等,一般官方或第三方都会提供原理图,可以用来分析。接下来要理解该处理器的启动过程,亲自 ...
  Color startColor = Color.red; Color endColor = Color.blue; // A non-cyclic gradient GradientPaint gradient = new GradientPaint( startX, startY, startColor, endX, endY, endColor); g2d.setPaint(gradient); drawShape(g2d); // A cyclic gradient gradient = new GradientPaint( startX, startY, st ...
  一般的转义序列采用如下格式 \ooo 这里的ooo 代表三个八进制数字组成的序列,八进制序列的值代表该字符在机器字符集 里的数字值。下面的示例使用ASCII 码字符集表示文字常量 \7 (bell) \14 (newline) \0 (null) \062 ('2') 另外字符文字前面可以加L,例如 L'a' 这称为宽字符文字类型为wchar_t,宽字符常量用来支持某些语言的字符集合。如汉语、 日语这些语言中的某些字符不能用单个字符来表示。 字符串文字常量由零个或多个用双引号括起来的字符组成,不可打印字符可以由相应的 转义序列来表示,而一个字符串文字可以扩展到多行,在 ...
x = 1 # global variable #全局变量 # alters the local variable x, shadows the global variable def a(): x = 25 #局部变量 print "\nlocal x in a is", x, "after entering a" #打印局部变量 x += 1 print "local x in a is", x, "before exiting a" #打印变化后的局部变量 # alters the global variabl ...
  <link href="css/style.css" rel="stylesheet"> <?php include("conn/conn.php"); %数据库连接文件 ?> <table width="563" height="587" border="0" cellpadding="0" cellspacing="0"> <tr> <td width=&quo ...

文字常量(1)

  C++预定义了一组数值数据类型,可以用来表示整数、浮点数和单个字符。此外,还预 定义了用来表示字符串的字符数组。 字符型char 通常用来表示单个字符和小整数,它可以用一个机器字节来表示。 整型int、短整型short、长整型long它们分别代表不同长度的整数值。典型情况 下short 以半个字表示,int 以一个机器字表示,而long 为一个或两个机器字。在 32 位机器中int 和long 通常长度相同。 浮点型float、双精度double和长双精度long double分别表示单精度浮点数、双 精度浮点数和扩展精度的浮点数值。典型情况下float 为一个字,dou ...
  // Use a predefined color. g2d.setColor(Color.red); drawShape(g2d); // Use a custom color. int red = 230; int green = 45; int blue = 67; g2d.setColor(new Color(red, green, blue)); drawShape(g2d);
  import random #导入random包 frequency1 = 0 frequency2 = 0 frequency3 = 0 frequency4 = 0 frequency5 = 0 frequency6 = 0 #定义六个变量,分别计频数 for roll in range( 1, 6001 ): # 6000 die rolls face = random.randrange( 1, 7 ) #掷6000次 if face == 1: # frequency counted frequency1 += 1 elif face == 2: f ...
  <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <link href="css/style.css" rel="stylesheet"> <title>九九供求信息网</title> <style type="text/css"> <!-- body { backgrou ...
Global site tag (gtag.js) - Google Analytics