__attribute__((packed))的作用
在结构体变量的声明中,经常可以看到__attribute__((packed))修饰符。这是做什么用的呢?请看一下程序:
#define u8 unsigned char
#define u16 unsigned short
#define u32 unsigned int
int main()
{
struct {
...
分类:
其他好文 时间:
2014-05-13 06:19:18
阅读次数:
416
理解二级指针,关键是理解指针的存储方式和意义。
这里以指向int型指针的指针为例,梳理一下二级指针在内存分配中 的奥妙....
#include
using namespace std;
int main()
{
int a[5] = {1, 2, 3, 4, 5};
int *p = a;
int **point = &p;
cout << "a = "...
分类:
其他好文 时间:
2014-05-12 23:22:28
阅读次数:
291
代码如下:AndroidManifest.xml:在后面增加一行:Activity_main.xml:
MainActivity.java:packageleihu.location01;importandroid.location.Location;importandroid.location.L...
分类:
其他好文 时间:
2014-05-12 20:27:17
阅读次数:
374
因项目需要采集2个摄像头的数据进行双目检测,一开始采用以下代码来测试:#include
"stdafx.h"#include #include #include int main(int argc, _TCHAR* argv[]){
CvCapture* capture1 = cvCreate...
分类:
其他好文 时间:
2014-05-12 19:37:55
阅读次数:
491
class Program { static void Main(string[] args) { int i = 940; int j = 73; Console.WriteLine("{0,5}\n+{1,4}\n------\n{2,4}",i,j,i+j); Console.ReadKey(); } }输出结果为:...
分类:
其他好文 时间:
2014-05-11 22:28:49
阅读次数:
298
public class ThreadTest implements Callable {
public String call() throws Exception {
// TODO Auto-generated method stub
wait(10000);
return "hello";
}
}调用代码:
public static void main(Stri...
分类:
编程语言 时间:
2014-05-11 21:27:24
阅读次数:
533
基本的注册功能有用户名、密码和密码确认,当然邮箱确认和基本信息填写在高阶的时候完善,现在只完成基本功能。在register.html写如下内容:
{%extends 'main.html'%}
{%block content%}
注册用户名不支持中文
用户名
密码
确认密码
注册
已有帐号,请直接登录
{%end%}
效果图如下...
分类:
其他好文 时间:
2014-05-11 20:37:07
阅读次数:
553
思路:简单的匹配操作,利用栈。
Code:
#include
#include
char stack[135];
int main()
{
int n;
scanf("%d",&n);
getchar();
while(n-->0)
{
memset(stack,0,sizeof(stack));
char c;
int top=0;
int flag=1;...
分类:
其他好文 时间:
2014-05-11 20:19:34
阅读次数:
376
内核要执行一个应用程序,唯一的途径是通过系统调用,exec函数,exec又会调用启动程序,启动程序(通常是汇编语言)以类似下面的方式调用main函数:
void exit(main(argc, argv));
那么在main函数末尾使用exit(0)和使用return 0是等价的。这里有三个正常终止程序的函数:
void exit(int status); // 先执行一些清理操作,...
分类:
其他好文 时间:
2014-05-11 20:11:19
阅读次数:
394
数据类型int类型 printf()输出八进制整数时,用%o代替%d,输出十六进制时,用%x。
%#o、%#x和%#X分别生成0、0x、0X前缀。1 #include 2 int main(void)3 {4 int x = 100;5
printf("dec = %d; oc...
分类:
其他好文 时间:
2014-05-11 17:50:15
阅读次数:
379