C语言写的字节查询器(初学C练手用)
用C语言写的一个简单的字节型查询器,主要功能是实现对 signed int float unsigned int double signed short int long double unsigned short int char long int unsigned long int 这几个类型的字节占用的查询 用的是VC6编译器 所以并不完全是纯C的
/************************************************************************
* Copyright (c) 2009, Simple1Day
*
* 文件名称:Item1.cpp
* 摘要:
* 提供查询int,short,long,float,double数据类型占用内存字节大小
*************************************************************************/
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
//执行函数定义
void SetInterface(void);//窗口设置函数
int QueryType(char * _pch);//查询函数
char ExChange(char _chLetter);//大写转换小写
void LoadStart(void);//开始画面
void LoadGuage(void);//载入进度条
void GotoXY(int x,int y); //光标定位x,y
void SetColor(unsigned short ForeColor=4,unsigned short BackGroundColor=0); //设置字体颜色
int IseChar(char* _pch,int _nNum); //切割字符(空格后开始)
int CtoI(char* _pch); //字符转整型
int GetInput(char* _pchinput); //输入字符串
void OpenHelp(void); //打开帮助
int Accord(char* _pchA,char* _pchB,int* _pnValue);//判断符合度
void MenuOptions();//选择菜单
void Typewriter(char* _psz,int _nSleep=200,int _nX=0,int _nY=0,int _nColor=30); //彩色打字机
void CheckInputError(int _arr_nInput[]);//检查错误位数
static int s_nMenu = 0;//选择框按键值
/************************************Main()******************************************
相关文档:
#include <stdio.h>
#include <stdlib.h>
#define SIZE 17
void reverse(int start, int end);
int data[SIZE] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
int main(void)
{
int i = 5;
reverse(0, i - 1);
reverse(i, SIZE-1);
reverse(0, SIZE-1);
return ......
c文件操作就这么简单
文件操作,稍微一总结.。
FILE是一个结构体类型,在TC和VS中定义不相同,他的作用就是在fopen()之后保存了打开文件的信息。也就是说操作系统帮我们完成了,我们不用管,大大降低了难度吧。
首先我们考虑下对文件的操作,文件类型分为文本和二进制。读写文件的函数一般前面有个f,也就表示file,open ......
<script>
a=62;
function encode() {
var code = document.getElementById('code').value;
code = code.replace(/[\r\n]+/g, '');
code = code.replace(/'/g, "\\'
");
var tmp = code.match(/\b(\w+)\b/g);
tmp.sort();
var dict = [];
var i, t = '';
for(var i=0; i<tmp.length ......
看了下官方文档的关于object c 的内存管理,总结下:
在iphone中object c 中的内存管理是通过计数器来管理的,每个对象内部都有一个计数器.新建一个对象,或者这个对象被其他对象引用,多会使计数器加1.Retain 增加计数器值 release 减少计数器值.当计数器为0时对象就deall ......
(一)
对文件操作时有时获得文件的大小时必要的.下面是获得其大小小的较简单方法.
#include<io.h> //C语言头文件
#include<iostream> //for system();
using namespace std;
int main()
{
int handle;
handle = open("test.txt", 0x0100); //open file for rea ......