Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 2nd, 2005, 11:05 PM   #1
kychan
Newbie
 
Join Date: Apr 2005
Posts: 1
Rep Power: 0 kychan is on a distinguished road
about write bytes to a file

i try to read a.wav and create the same file as receive.wav

but receive.wav is not the same as a.wave
receive.wav is different after getting '00' in hexa format.
what is the problem ?

FILE *fp=fopen("a.wav","rb");
FILE *fp2 = fopen ("receive.wav" , "wb");

// obtain the file size
fseek (fp , 0 , SEEK_END);
lSize = ftell (fp);
rewind(fp);

// allocate memory to contain the whole file.
buffer = (char*) malloc (lSize);
if (buffer == NULL) return FALSE;

// copy the file into the buffer.
fread (buffer,1,lSize,fp);

if(fp2 != NULL)
{
cout<<"size"<<fwrite (buffer , 1 , lSize , fp2)<<endl;
fclose (fp2);
}
fclose (fp);
kychan is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:31 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC