文件操作

DWORD rsize;
HANDLE hopenfile =  CreateFile("e:\\q.txt",   // open two.txt
GENERIC_WRITE|GENERIC_READ,                // open for writing
0,                            // do not share
NULL,                         // no security
CREATE_ALWAYS,                  // open or create
FILE_ATTRIBUTE_NORMAL,        // normal file
NULL);                        // no attr. template 
DWORD sd = GetLastError();
if (hopenfile == INVALID_HANDLE_VALUE)
{
hopenfile = NULL;
MessageBoxA(NULL, "can not open the file", "playwav", MB_OK);

BOOL ff = WriteFile(hopenfile,buf, len, &rsize, NULL);
sd = GetLastError();
CloseHandle(hopenfile); 




//ADD ADTS Header
unsigned char * newbuf;
newbuf = (unsigned char *)malloc(len+8);
memset(newbuf,len+8,0);
make_AAC_Header(newbuf,16000,len); 


    HANDLE hFileOld = CreateFile("D:\\audio_frm.wav.aac",
GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD _Readed = 0;
unsigned char *_pbBuffer = (unsigned char *)malloc(557);
memset(_pbBuffer,0,557);
     _Readed = SetFilePointer(hFileOld,(LONG)391,NULL,FILE_BEGIN);
      if(!ReadFile(hFileOld, _pbBuffer, 556, &_Readed, NULL))
 {
 return FALSE;
 }
buf =_pbBuffer;
len = 556;


char *  bug  ; 
bug = (char *)malloc(100);
memset(bug,0,100); 
 

你可能感兴趣的:(File,header,null,audio)