Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

HALP

Name: Anonymous 2007-02-10 18:58

char temp4[3];
unsigned long int FileStart;
FileStart = (temp4[3] << 24) | (temp4[2] << 16) | (temp4[1] << 8) | (temp4[0]);

This was supposed to take four bytes and turn them into a long int. How do I do this so that the << doesn't turn every byte other than the first one into 'FF'?

Name: Anonymous 2007-02-11 4:24

>>7 you're just wrong.
a[3] has 4 elements.
a[0] a[1] a[2] a[3].
Try this code :

#include <stdio.h>
#include <string.h>

main() {
   
    char a[3];
    int i = 0;
    memset(a, 'A', 4);
   
    putchar((int)a[0]);
    putchar((int)a[1]);
    putchar((int)a[2]);
    putchar((int)a[3]);
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List