记录:数据类型
2012-07-08 22:53
113 查看
把书本上没有见过的一些类型记录在此,可以回顾。!!~~
在CSDN的论坛上提供了一段代码:
其中出现了一个在此之前没有看过的数据类型。记录一下。
View Code
在程序中出现__int64这个数据类型。现在说说自己找到并学习到的内容。
现在还不知道它在哪个库上的。
根据参考内容,得知:
“typedef为C语言的关键字,作用是为一种数据类型定义一个新名字。
在编程中使用typedef目的一般有两个,一个是给变量一个易记且意义明确的新名字,另一个是简化一些比较复杂的类型声明。
“在格式化输出则还需要结合一个d,即%I64d。对于无符号的ULONGLONG,则是%I64u。
内容参考网址:
C++零食:wprintf 中使用%I64d格式化输出LONGLONG:"/article/5151601.html"
typedef_百度百科:"http://baike.baidu.com/view/1283800.htm"
C/C++的64位整型:"http://www.byvoid.com/blog/c-int64/"
其中《C/C++的64位整型》上的内容强大。。找到自己所要的信息。
待续。
在CSDN的论坛上提供了一段代码:
其中出现了一个在此之前没有看过的数据类型。记录一下。
View Code
#include <sys\stat.h> #include <io.h> #include <fcntl.h> #include <share.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> #include <string.h> #define MAX_CLU_BYTES 65536 FILE *fo; int fh; __int64 offs,offs1; __int64 rvi64; int rv,wrv; unsigned char buf[MAX_CLU_BYTES]; char ofn[_MAX_PATH]; char offstr[80]; void strcpybutcomma(char *t,char *s) { char c; while (1) { c = *s++; if (','!=c) *t++ = c; if (0==c) break; } } void main(int argc,char **argv) { if (argc<3) { printf("Copy File Tail.\n"); printf("Usage:\n"); printf(" cft filename.ext offset_begin[-offset_end]\n"); printf("Copy filename.ext offset_begin[-offset_end] to offset_begin[-offset_end]-filename.ext\n"); printf("Note: Byte at offset_end is NOT included.\n"); printf("Example:\n"); printf(" cft abc.rar 12345\n"); printf("Copy abc.rar offset 12345-end to 12345-abc.rar\n"); printf(" cft abc.rar 123-12345\n"); printf("Copy abc.rar offset 123-12345 to 123-12345-abc.rar\n"); printf(" cft abc.rar 0xAB-0xCD\n"); printf("Copy abc.rar offset 0xAB-0xCD to 0xAB-0xCD-abc.rar\n"); return; } strcpybutcomma(offstr,argv[2]); rv=sscanf(offstr,"%I64i-%I64i",&offs,&offs1); if (rv==0) { printf("offset %s is not number\n",argv[2]); return; } fh=_sopen(argv[1],_O_BINARY|_O_RDONLY|_O_RANDOM,_SH_DENYWR); if (fh==-1) { printf("_sopen %s errno=%d\n",argv[1],errno); return; } if (rv==1) { offs1=_filelengthi64(fh); if (offs1==-164i) { printf("%I64=_filelengthi64 errno=%d\n",offs1,errno); _close(fh); return; } } else {//rv==2 if (offs1<offs) { printf("%s offset_begin>offset_end error\n",argv[2]); _close(fh); return; } } rvi64=_lseeki64(fh,offs,SEEK_SET); if (rvi64!=offs) { printf("%I64u=_lseeki64 %I64u errno=%d\n",rvi64,offs,errno); _close(fh); return; } sprintf(ofn,"%s-",offstr); strcat(ofn,argv[1]); fo=fopen(ofn,"wb"); if (fo==NULL) { _close(fh); printf("fopen %s error\n",ofn); return; } cprintf("\n%I64u\r",offs); while (1) { rv=_read(fh,buf,(unsigned int)__min(offs1-offs,MAX_CLU_BYTES)); if (rv==0) break;// if (rv<0) { fclose(fo); _close(fh); printf("_read %s offset %I64u error\n",argv[1],offs); return; } wrv=fwrite(buf,1,rv,fo); if (wrv!=rv) { fclose(fo); _close(fh); printf("fwrite %s error\n",ofn); return; } else { offs+=rv; cprintf("%I64u\r",offs); if (offs>=offs1) break;// } } fclose(fo); _close(fh); printf("Copy %s offset %s to %s OK.\n",argv[1],argv[2],ofn); }
在程序中出现__int64这个数据类型。现在说说自己找到并学习到的内容。
现在还不知道它在哪个库上的。
根据参考内容,得知:
typedef __int64 LONGLONG;
“typedef为C语言的关键字,作用是为一种数据类型定义一个新名字。
在编程中使用typedef目的一般有两个,一个是给变量一个易记且意义明确的新名字,另一个是简化一些比较复杂的类型声明。
“在格式化输出则还需要结合一个d,即%I64d。对于无符号的ULONGLONG,则是%I64u。
内容参考网址:
C++零食:wprintf 中使用%I64d格式化输出LONGLONG:"/article/5151601.html"
typedef_百度百科:"http://baike.baidu.com/view/1283800.htm"
C/C++的64位整型:"http://www.byvoid.com/blog/c-int64/"
其中《C/C++的64位整型》上的内容强大。。找到自己所要的信息。
待续。
相关文章推荐
- C语言基础数据类型与运算符号复习记录
- easyui-datagrid关于展示的字段需要进行数据类型转换的问题(自己记录备忘)
- oracleday18(数据类型记录变量 多个变量放一个自创的里面 )
- Mysql的timestamp类型,自动记录数据的更新时间
- 统说ado对象游标类型(Connection,RecordSet)以及显示数据记录的三板斧
- 修改数据表DataTable某一列的类型和记录值(正确步骤:1.克隆表结构,2.修改列类型,3.修改记录值,4.返回希望的结果)
- redis命令及操作记录以及redis的五种数据类型介绍
- 统说ado对象游标类型(Connection,RecordSet)以及显示数据记录的三板斧
- android jni常用数据类型的记录
- java记录--数据类型
- Python学习记录一,基本的输入输出数据类型
- 有符号无符号数据类型溢出测试记录
- Java记录 -2- 原生数据类型
- Java记录 -3- 原生数据类型2
- Java记录 -3- 原生数据类型2
- pl/sql复合数据类型_pl/sql记录类型
- 数据类型之记录(record)
- Lua学习记录 — (1) 变量及数据类型
- D3.js学习记录 - 数据类型【转】【新】
- 数据库:统说ado对象游标类型(Connection,RecordSet)以及显示数据记录的三板斧