摘要:
private static readonly int CHUNK_ALL_SIZE = 308; //总的区间长度private static readonly int CHUNK_DATA_SIZE = 288; //Key数据长度private static readonly int CHUNK_CHECKSUM_SIZE = 20; //Key的CheckSum长度private void btnSaveDB_Click(object sender, EventArgs e){ try { this.Cursor = Cursors.AppStarting; //秒表统计运行时间 St 阅读全文
随笔档案-2013年03月
VB内存拷贝方式读取二进制文件(二进制数据转换为16进制字符串)
2013-03-21 13:51 by 渔者, 1319 阅读, 收藏,
摘要:
使用CopyMemory的API函数,内存拷贝。Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _ (Destination As Any, Source As Any, ByVal Length As Long)VB代码Sample如下:功能描述:VB通过调用C++接口读取二进制文件,按照约定格式按序读取Data,读出的二进制内容转换成字符串(16进制格式字符串);Option Explicit'''''''& 阅读全文
C#读写文件总结
2013-03-21 11:11 by 渔者, 223 阅读, 收藏,
摘要:
1、使用FileStream读写文件文件头:[csharp] view plaincopyprint?using System;using System.Collections.Generic;using System.Text;using System.IO;using System;using System.Collections.Generic;using System.Text;using System.IO;读文件核心代码:[csharp] view plaincopyprint?byte[] byData = new byte[100];char[] charData = new 阅读全文
C#计算代码执行时间
2013-03-21 11:09 by 渔者, 2460 阅读, 收藏,
摘要:
在一些测试工作时我们需要获得高精度的代码执行时间以比较其效率。最近遇到一个模块其执行时间非常短,但是调用频率非常高。精确计算其运算时间对于提高程序整体效率来说非常重要。 在我刚刚接触.Net时,也曾经想要测试一下自己写的程序的运行时间,当时我使用的是将两个DateTime.Now相减的笨方法,呵呵。后来知道使用Environment.TickCount,对于一般的测试来说就足够了。但是它对于高精度测试就没什么办法,经常是返回个0了事。对于高精度测试我们应当使用QueryPerformanceFrequency函数和QueryPerformanceCounter函数。通过它们可以获得比... 阅读全文
浙公网安备 33010602011771号