S
seia0106
Hello
In the course of writing a program. I have to read and write a media
file(*.avi/*.mpg/*.wav) to and from memory buffer. I can put the
data(from a *.avi file)in buffer successfully but when i try to write
data from buffer into a new file, then i can not play that file. A
file size of only 4kb is copied and i can not play the file.
The size of original file, whose contents were copied into buffer was
996KB.
Can anyone please help me solve this problem. Why only 4KB are written
into file. I guess may be the problem is in third paramater of
fwrite() function 'NumberOfElements', but i am not sure. Here is my
simple function
pBuffer was declared as global variable of type BYTE
void WriteMediaFile(const char file_name[]) {
/* Local variable declarations: */
FILE *outdata;
if ((outdata = fopen(file_name, "w")) == NULL) {
fprintf(stderr, "***> Open error reading input file %s",
file_name);
exit(-1);
} /* end if */
fwrite(&pBuffer, sizeof(pBuffer), 1 , outdata);
fclose(outdata);
} /* end function */
In the course of writing a program. I have to read and write a media
file(*.avi/*.mpg/*.wav) to and from memory buffer. I can put the
data(from a *.avi file)in buffer successfully but when i try to write
data from buffer into a new file, then i can not play that file. A
file size of only 4kb is copied and i can not play the file.
The size of original file, whose contents were copied into buffer was
996KB.
Can anyone please help me solve this problem. Why only 4KB are written
into file. I guess may be the problem is in third paramater of
fwrite() function 'NumberOfElements', but i am not sure. Here is my
simple function
pBuffer was declared as global variable of type BYTE
void WriteMediaFile(const char file_name[]) {
/* Local variable declarations: */
FILE *outdata;
if ((outdata = fopen(file_name, "w")) == NULL) {
fprintf(stderr, "***> Open error reading input file %s",
file_name);
exit(-1);
} /* end if */
fwrite(&pBuffer, sizeof(pBuffer), 1 , outdata);
fclose(outdata);
} /* end function */