Search Results

Search found 2 results on 1 pages for 'mauvehead'.

Page 1/1 | 1 

  • Why am I not getting the expected results with fread() in C?

    - by mauvehead
    Here is my code: #include <stdio.h> int main(void) { FILE *fp; unsigned int i; char bytes[512]; fp = fopen("myFile","r"); for(i = 0;i <= 512;i++) { fread(&bytes, sizeof(bytes), 1, fp); printf("bytes[%d]: %x\n", i, bytes[i]); } } Here is the expected output $ hexdump myFile 0000000 aa55 aa55 0060 0000 0a17 0000 b1a5 a2ea 0000010 0000 0000 614c 7563 616e 0000 0000 0000 0000020 0000 0000 0a68 0000 1001 421e 0000 0000 0000030 f6a0 487d ffff ffff 0040 0000 002f 0000 But here is what I see from my program bytes[0]: 55 bytes[1]: 8 bytes[2]: ffffffc8 bytes[3]: ffffffdd bytes[4]: 22 bytes[5]: ffffffc8 bytes[6]: ffffff91 bytes[7]: 63 bytes[8]: ffffff82 My obvious guess is that I'm either addressing something incorrectly and receiving the wrong data back or I am printing it incorrectly and viewing it the wrong way.

    Read the article

  • How to gain greater control of network packets on Android

    - by mauvehead
    I'm looking to design an application that will require some deep control over IP packets. Looking over the reference guide on the developers site at Android I see very limited control over packets from java.net:SocketOptions and java.net:DatagramPacket. Specifically I'm looking to control the individual bits within the packet to set TCP Flags, SYN/ACK/RST, and so forth. Based on the docs I am assuming I cannot do this within the Java API provided by Android and I'm guessing I'll have to do it some other way? Anyone have any insight on this?

    Read the article

1