±à³ÌÒÕÊõ(C/C++)
1¡¢¿ìËÙ³õʼ»¯
char *str = new [size];
str[0]='\0';
2¡¢memcpyµÄÃîÓÃ
ÊÔÌâ6£ºÒÑÖªWAVÎļþ¸ñʽÈçÏÂ±í£¬´ò¿ªÒ»¸öWAVÎļþ£¬ÒÔÊʵ±µÄÊý¾Ý½á¹¹×éÖ¯WAVÎļþÍ·²¢½âÎöWAV¸ñʽµÄ¸÷ÏîÐÅÏ¢¡£
WAVEÎļþ¸ñʽ˵Ã÷±í
Æ«ÒƵØÖ· ×Ö½ÚÊý Êý¾ÝÀàÐÍ ÄÚ ÈÝ
ÎļþÍ·
00H 4 Char "RIFF"±êÖ¾
04H 4 int32 Îļþ³¤¶È
08H 4 Char "WAVE"±êÖ¾
0CH 4 Char "fmt"±êÖ¾
10H 4 ¹ý¶É×Ö½Ú£¨²»¶¨£©
14H 2 int16 ¸ñʽÀà±ð
16H 2 int16 ͨµÀÊý
18H 2 int16
²ÉÑùÂÊ£¨Ã¿ÃëÑù±¾Êý£©£¬±íʾÿ¸öͨµÀµÄ²¥·ÅËÙ¶È
1CH 4 int32 ²¨ÐÎÒôƵÊý¾Ý´«ËÍËÙÂÊ
20H 2 int16 Êý¾Ý¿éµÄµ÷ÕûÊý£¨°´×Ö½ÚËãµÄ£©
22H 2 ÿÑù±¾µÄÊý¾ÝλÊý
24H 4 Char Êý¾Ý±ê¼Ç·û£¢data£¢
28H 4 int32 ÓïÒôÊý¾ÝµÄ³¤¶È
½â´ð£º
½«WAVÎļþ¸ñʽ¶¨ÒåΪ½á¹¹ÌåWAVEFORMAT£º
typedef struct tagWaveFormat
{
char cRiffFlag[4];
UIN32 nFileLen;
char cWaveFlag[4];
char cFmtFlag[4];
char cTransition[4];
UIN16 nFormatTag ;
UIN16 nChannels;
UIN16 nSamplesPerSec;
UIN32 nAvgBytesperSec;
UIN16 nBlockAlign;
UIN16 nBitNumPerSample;
char cDataFlag[4];
UIN16 nAudioLength; } WAVEFORMAT;
¼ÙÉèWAVÎļþÄÚÈݶÁ³öºó´æ·ÅÔÚÖ¸Õëbuffer¿ªÊ¼µÄÄÚ´æµ¥ÔªÄÚ£¬Ôò·ÖÎöÎļþ¸ñʽµÄ´úÂëºÜ¼òµ¥£¬Îª£º WAVEFORMAT waveFormat;
memcpy( &waveFormat, buffer,sizeof( WAVEFORMAT ) );
Ö±½Óͨ¹ý·ÃÎÊwaveFormatµÄ³ÉÔ±£¬¾Í¿ÉÒÔ»ñµÃÌض¨WAVÎļþµÄ¸÷Ïî¸ñʽÐÅÏ¢¡£
ÆÊÎö£º
ÊÔÌâ6¿¼²éÃæÊÔÕß×éÖ¯Êý¾Ý½á¹¹µÄÄÜÁ¦£¬ÓоÑéµÄ³ÌÐòÉè¼ÆÕß½«ÊôÓÚÒ»¸öÕûÌåµÄÊý¾Ý³ÉÔ±×é֯Ϊһ¸ö½á¹¹Ì壬ÀûÓÃÖ¸ÕëÀàÐÍת»»£¬¿ÉÒÔ½«memcpy¡¢memsetµÈº¯-ÊýÖ±½ÓÓÃÓڽṹÌåµØÖ·£¬½øÐнṹÌåµÄÕûÌå²Ù×÷¡£
͸¹ýÕâ¸öÌâ¿ÉÒÔ¿´³öÃæÊÔÕߵijÌÐòÉè¼Æ¾ÑéÊÇ·ñ·á¸»¡£
Ïà¹ØÎĵµ£º
һƪ½²¶ÔÆë±È½ÏºÃµÄÎÄÕ£¬×ªÌùÈçÏÂ:
´óÖ±ê×¢Ò»¶þ:
1.ÄÚ´æ¶ÔÆë:¼ÆËã»úϵͳ¶Ô»ù±¾ÀàÐÍÊý¾ÝÔÚÄÚ´æÖдæ·ÅµÄλÖÃÓÐÏÞÖÆ£¬ËüÃÇ»áÒªÇóÕâЩÊý¾ÝµÄÊ×µØÖ·µÄÖµÊÇij¸öÊýk(ͨ³£ËüΪ4»ò8)µÄ±¶ÊýkÔò±»³ÆΪ¸ÃÊý¾ÝÀàÐ͵ĶÔÆëÄ£Êý(alignment modulus)
2.²»Í¬±àÒëÆ÷ĬÈϵÄ×î´ó¶ÔÆë×Ö½ÚÊýÊDz»Ò»ÑùµÄ,±ÈÈçvc==8,gcc==4,¿ÉÒÔͨ¹ ......
ºÍÔÚIDEÖбàÒëÏà±È£¬ÃüÁîÐÐģʽ±àÒëËٶȸü¿ì£¬²¢¿ÉÒÔ±ÜÃâ±»IDE²úÉúµÄһЩ¸½¼ÓÐÅÏ¢Ëù¸ÉÈÅ¡£±¾ÎĽ«½éÉÜ΢ÈíC/C++±àÒëÆ÷ÃüÁîÐÐģʽÉ趨ºÍÓ÷¨¡£ 1¡¢ÉèÖû·¾³±äÁ¿£º PATH=C:\Program Files\Microsoft Visual Studio 8\VC\bin INCLUDE=C:\Program Files\Microsoft Visual Studio 8\VC\include LIB=C:\Program Files\Microsof ......
BoundsChecker²ÉÓÃÒ»ÖÖ±»³ÆΪ Code InjectionµÄ¼¼Êõ£¬À´½Ø»ñ¶Ô·ÖÅäÄÚ´æºÍÊÍ·ÅÄÚ´æµÄº¯ÊýµÄµ÷Ó᣼òµ¥µØ˵£¬µ±ÄãµÄ³ÌÐò¿ªÊ¼ÔËÐÐʱ£¬BoundsCheckerµÄDLL±»×Ô¶¯ÔØÈë½ø³ÌµÄµØÖ·¿Õ¼ä£¨Õâ¿ÉÒÔͨ¹ýsystem-levelµÄHookʵÏÖ£©£¬È»ºóËü»áÐ޸Ľø³ÌÖжÔÄÚ´æ·ÖÅäºÍÊͷŵĺ¯Êýµ÷Óã¬ÈÃÕâЩµ÷ÓÃÊ×ÏÈתÈëËüµÄ´úÂ룬ȻºóÔÙÖ´ÐÐÔÀ´µÄ´úÂë¡£Bo ......
[C/C++ Digestion] –
×Ôµ×ÏòÉϵØ̽¾¿Ð麯Êý
×÷Õߣº
Jason Lee @
http://blog.csdn.net/jasonblog
ÈÕÆÚ£º
2010-05-19
»·¾³£º
Visual C++ Express
2008
ÉùÃ÷£º±¾ÎÄ·¢±íÔÚ
csdn
²©¿Í£¬ÈçÓÐתÔØ£¬Çë×¢Ã÷³ö´¦
[1]C++
¶ÔÏóÄ£ÐÍ»ù´¡
Ò»¸öÀàÖпÉÒÔ°üº¬¾²Ì¬Êý¾Ý³ÉÔ±¡¢¾²Ì¬³ÉÔ±º¯Êý¡¢·Ç¾²Ì¬³ÉÔ±º¯Êýº ......