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

Wut ? C

Name: Anonymous 2007-11-16 12:09

AviStruct* GetVideoInfo(char*file)
{
    AviStruct* MyVideo = (AviStruct*)s_alloc(sizeof(AviStruct));
    FILE*f = fopen(file,"rb");
    if (f)
    {
        unsigned int dwRate;
        unsigned int dwScale;
        unsigned int dwLength;
        fseek(f,0x84, SEEK_SET );
        fread(&dwRate,4,1,f);
        fseek(f,0x80, SEEK_SET );
        fread(&dwScale,4,1,f);
        fseek(f,0x8C, SEEK_SET );
        fread(&dwLength,4,1,f);
        fseek(f,0x40, SEEK_SET );
        fread(&MyVideo->width,4,1,f);
        fseek(f,0x44, SEEK_SET );
        fread(&MyVideo->height,4,1,f);
        MyVideo->fFps = (float)((float)(dwRate)/(float)(dwScale));
        MyVideo->fDuration = (float)((float)(dwLength)/(float)(MyVideo->fFps));
        return MyVideo;

    }
    return 0x0;
}

Name: Anonymous 2007-11-17 15:09

>>15
You're a fucking idiot for not knowing they're the same damn thing.

NULL is a #define for (void*)0

>>13
still forgetting the fact hes returning a pointer, this isnt C++ where 0 == NULL, wait is it?

>>17
1. cant be fucked, we're all trolls here
2. tiredness
3. learning java

>>18
fail for assuming endianness, enjoy your reversed bits

plus, you should check the size of the integer via a #define as provided by the system headers then using #define to create the correct structure and function, your function adds too much overhead at runtime

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