Sign in to follow this  
illadel4life

I need help with fread

Recommended Posts

I open a file thats 6 mb big. I try to read each "short" one at a time. I count how many times I do, and the count my program spits back is 1k and some change. If my math is correct, I should get around 3 million right? 1k * 2( bytes a short) = 2k bytes < 6 m bytes. I do not know how to "post" code but I will try. <code> FILE *tfile; unsigned short buffer = 0; short data[32]; unsigned int c = 0; unsigned int i = 0; unsigned int total = 0; unsigned int sum = 0; bool match = false; clear(data); tfile = fopen("c://test.mp3","r"); while ( fread( &buffer, sizeof(short), 1, tfile) >= 1) { </code> Any Ideas? thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by illadel4life
I do not know how to "post" code but I will try.

Without the spaces:

[ code][ /code]
FILE *tfile;
unsigned short buffer = 0;
short data[32];
unsigned int c = 0;
unsigned int i = 0;
unsigned int total = 0;
unsigned int sum = 0;
bool match = false;

clear(data);

tfile = fopen("c://test.mp3","r");


while ( fread( &buffer, sizeof(short), 1, tfile) >= 1) {



[ source][ /source]

FILE *tfile;
unsigned short buffer = 0;
short data[32];
unsigned int c = 0;
unsigned int i = 0;
unsigned int total = 0;
unsigned int sum = 0;
bool match = false;

clear(data);

tfile = fopen("c://test.mp3","r");


while ( fread( &buffer, sizeof(short), 1, tfile) >= 1) {


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this