I need to change some that uses pointers in C #.
Essentiay has given me buffer latent data and it needs treatment as if it has been formatted. This is usually read from the file, but it can not be that it can come from different AMMbid C applications running hardware.
In this example, I need to treat it as a long array.
The ICI just makes one point for a long time and then the address of the buffer is inserted.
But in C # I did not have to take the address of the managed object and it does not want me to enter a byte []
So how do I properly c #
can perform zero test function (zero) {four buffer [256]; PrintBufferAsLongPointer (buffer); PrintBufferAsLongArray (buffer); } Zero PrintBufferAsLongPointer (char * buffer) {long * * ptr = (long *) buffer; For (integer number = 0; calculation & lt; 64; calculation ++) {printf ("% x", * ptr ++); }} {Printf ("% x", buffer [index]) for zero printbufferAsLongArray (char * buffer) {{int index = 0; index & lt; index; }}
You can still use the indicators in C # if you are careful (And 'vulnerable code' in the competent project option):
Private static unprotected zero print buffer ASLong array (byte [] buffer) {fixed (byte * pBuffer = buffer) {long * longData = (long * ) PBuffer; (Int index = 0; index & lt; 64; index ++) for console. WrightLine ("{0: X}", long data [index]); }}
No comments:
Post a Comment