显示标签为“c”的博文。显示所有博文
显示标签为“c”的博文。显示所有博文

20100420

No man page for libc function 'fprintf'

# sudo apt-get install manpages-dev

ref:https://lists.ubuntu.com/archives/ubuntu-users/2009-May/182747.html

20090430

编辑软盘镜像img文件的工具

看这里是软件作者的Blog:http://blog.csdn.net/bacy001/archive/2008/04/11/2280437.aspx

工具很简单,很好用,而且还有源代码,C编写的。

需要下载的请登陆作者的Blog吧!!

忘记说名称了——

Floppy Disk Image Editor

20090311

如何找出指针的类型

比如有如下的指针定义,去掉指针声明语句中的指针名ptr,剩下的就是指针的类型了。
  (1)int*ptr;//指针的类型是int*
  (2)char*ptr;//指针的类型是char*
  (3)int**ptr;//指针的类型是int**
  (4)int(*ptr)[3];//指针的类型是int(*)[3]
  (5)int*(*ptr)[4];//指针的类型是int*(*)[4]

C语言如何寻址

汇编里面可以简单的写作ES:SI,可是在C里面需要指针来操作:

#include 
int main(void)
{
int a;
unsigned char far * pMem = (unsigned char far *)0xf000ff00; //It is f000:ff00
a=*pMem;
printf("%02x", a);
return 0;
}


还需要更强的指针知识才好阿!!

Reference:
http://www.oldlinux.org/oldlinux/viewthread.php?tid=11169&extra=page%3D1

20090310

tcc混合编译C和汇编不能使用结构体

tcc编译的时候不认识结构体,所以回报很多错误。

把结构体展开为变量就好了。

20090206

在https://opensvn.csie.org/上面建立lsACPI项目

https://opensvn.csie.org/上面建立lsACPI项目

C和汇编混合编写一个小工具,能够ls ACPI的Tables。

20090123

Error: Unable to execute command 'tasm.exe'

用TC3混合编译C和ASM,刚搭建的环境,首次编译报错:
D:\MASM\WORKS>tcc.exe -ID:\TURBOC3\INCLUDE -LD:\TURBOC3\LIB -B ACPI.C ACPIi.ASM

Turbo C++ Version 3.00 Copyright (c) 1992 Borland International
acpi.c:
Error: Unable to execute command 'tasm.exe'

tc和masm的bin目录的环境变量都设好了啊
tc下面也有tasm.exe,而且cmd下可以直接运行tasm。
后来把tasm.exe删除掉,发现错误没有变化,才想到会不会是tc到masm目录下找的tasm.exe啊(而不是自己目录下),于是把tc下的tasm.exe移动到了masm下,一编译,果然成功了。

在网上查了好久,发现大家问题都出在tc下面没有tasm.exe上,没想到我这里的问题这么特殊。

20081209

C语言中如何不等待用户输入而获取到键盘扫描码

以往使用getch()函数获取用户输入案件的ASCII码,可是这个有两个缺点:
1. 得等待用户输入之后程序才能向下执行,在一些需要实时刷新的地方可能就会很头大。
2. 不能得到回车键的ASCII码,确切说回车键是没有ASCII码的,所谓的0D和0A是换行。

如果使用不跨平台的bioskey()函数就可以做到。

例如:
if(bioskey(1))
{
switch(bioskey(0))
{
...
}
}
bioskey(1)判断是否有按键按下,如果有则返回“1”,然后进入if语句。
bioskey(0)进一步获取按下的按键的扫描码。