Hi all

I have to read data from a binary file .And that data is at a particular address F7F0 and i have to store that data in a variable . As far as i know the binary file contains address. But can that address be printed or taken for any kind of manipulations?? Do we have any method to retrieve the data from any specific address. Can anyone help me ?

Recommended Answers

All 2 Replies

Use System.IO.FileStream class and Seek method to set current position of the stream.

Its a bit confusing t hear you talking about Binary and memory addresses in the same context in a .NET / C# forum. But say you really had to, as the previous poster has stated you could use the FileStream class to do some basic workarounds with Binary data.

But I would advise you to use a more Binary specific reader and write as the BinaryReader and BinaryWriter classes. and if you are talking about the memory data domain, you will have to use the unsafe keywork in C# as in

unsafe{/*unsafe , low level code*/}

and further more set the unsafe flag on your project IDE options or pass /unsafe to csc if you're using the cmd-line UI.

and for printing or saving addresses you may wanna try pointers which are in the same context as unsafe code.
and you can print the address with &varName;(address) or *varName (hump in memory to get contents)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.