同题目,我想生成16进制文件,生成这个文件可以直接用16进制编辑器打开,这个文件中比如offset都应该由程序指定。如果c#实现不了,需要用什么实现?最好给代码演示,多谢高手!
解决方案 »
- wcf传输大于5021条数据报错
- VS 2010 有没有 查看文件结构的插件
- 如何在WCF下返回RadarCube中TCubeMeasures,TDimension类型对象
- c# 网络编程的问题(非常紧急)在线等待
- WEB上的水晶报表怎么控制大小啊?
- 已经从以前的提问中搜索过了,请大家帮忙啊。
- if语句的问题
- 如何读取硬盘大小!!!!!!!!!!!!!!!!快!1! 谢谢!!!
- C# 关于数据库连接失败时程序卡住无反应的问题
- !!!%%%征集小程序(类似打开光驱,重新启机之类的)%%%%!!!
- 请问Clipboard中从网页上复制的内容时,通过GetData(DataFormats.Html)获取的文本是什么编码的?怎样知道?
- 如何开发带有试用次数或天数的程序
BinaryWriter bw = new BinaryWriter(fs);bw.Write(......) 随便什么基本类型都能写
可以用
FileStream.Position
StreamWriter.BaseStream.Position
StreamReader.BaseStream.Position
……
来指定offset
他们都有一个SetLength方法可以修改文件长度
Example
// crt_fseek.c
/* This program opens the file FSEEK.OUT and
* moves the pointer to the file's beginning.
*/#include <stdio.h>int main( void )
{
FILE *stream;
char line[81];
int result; stream = fopen( "fseek.out", "w+" );
if( stream == NULL )
printf( "The file fseek.out was not opened\n" );
else
{
fprintf( stream, "The fseek begins here: "
"This is the file 'fseek.out'.\n" );
result = fseek( stream, 23L, SEEK_SET);
if( result )
perror( "Fseek failed" );
else
{
printf( "File pointer is set to middle of first line.\n" );
fgets( line, 80, stream );
printf( "%s", line ); }
fclose( stream );
}
}
Output
File pointer is set to middle of first line.
This is the file 'fseek.out'.
Console.WriteLine( a.ToString( "{X}" ) );
可以给你这么点提示。