Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

±à³ÌÒÕÊõ(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ÌÐòÉè¼Æ¾­ÑéÊÇ·ñ·á¸»¡£


Ïà¹ØÎĵµ£º

C/C++±àÒëÆ÷ cl.exeµÄÃüÁîÑ¡Ïî

ºÍÔÚ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 ......

½â¾öCºÍC++ÖÐÉú³ÉµÄEXEÎļþÖ´Ðк󴰿ھÍÏûʧÁË£¡

Óô˷¨Ç°È·±£ÄãµÄCÔ´´úÂëÊÇÎÞ´íµÄ~~
½â¾ö°ì·¨£º
C:
ÔÚÖ÷º¯Êýºó¼Ógetch()»òch=getch();    (ÈóÌÐòµÈ´ýÄã°´ÏÂÈÎÒâ¼ü£¬ÔÙ¼ÌÐøÖ´ÐÐÏÂÃæµÄÓï¾ä)
C++:
1.°üº¬Í·Îļþʱ£º #include   <stdlib.h>/*header file£¬ÒòΪÔÚstdlib.hÍ·ÎļþÖж¨ÒåÁËsystem()º¯Êý*/
2.ÔÚ×îºóÒ»¾ä¼ÓÉÏ£ºsystem("PAUSE ......

ANSI CÓ¦ÓóÌÐòÉè¼Æ

1£¬´«Öµµ÷ÓÃ
ÿ¸öʵ²Î¶¼ÊÇÒ»¸ö±í´ïʽ£¬¶¼ÓÐÒ»¸öÖµ¡£Í¨¹ý¸´ÖƱí´ïʽֵµÄ·½Ê½£¬½«Æä´æ´¢ÔÚÒ»¸öÁÙʱµ¥ÔªÖУ¬²¢°Ñ¶ÔÓ¦µÄÐÎʽ²ÎÊý×÷ΪÕâ¸öµ¥ÔªµÄ±êʶ·û¡£¸Ã´«µÝʵ²Î·½·¨±»³Æ×÷´«Öµµ÷Óá£call by value
2£¬Ô¤´¦ÀíÆ÷
±àÒëÆ÷°Ñ³ÌÐòת»»ÎªÄ¿±ê´úÂë֮ǰÏÈÓÉCÔ¤´¦ÀíÆ÷´¦ÀíÔ´Îļþ¡£
CÔ´´úÂë->Ô¤´¦ÀíÆ÷->±àÒëÆ÷
Ô¤´¦ÀíÆ÷Ö´Ðг ......

C/C++ÎļþµÄ²Ù×÷£¨fread() fwrite()£©

freadº¯ÊýºÍfwriteº¯Êý
1.º¯Êý¹¦ÄÜ
  ÓÃÀ´¶Áдһ¸öÊý¾Ý¿é¡£
2.Ò»°ãµ÷ÓÃÐÎʽ
  fread(buffer,size,count,fp);
  fwrite(buffer,size,count,fp);
3.˵Ã÷
  £¨1£©buffer£ºÊÇÒ»¸öÖ¸Õ룬¶ÔfreadÀ´Ëµ£¬ËüÊǶÁÈëÊý¾ÝµÄ´æ·ÅµØÖ·¡£¶ÔfwriteÀ´Ëµ£¬ÊÇÒªÊä³öÊý¾ÝµÄµØÖ·¡£
  £¨2£©size£ºÒª¶ÁдµÄ×Ö½ÚÊý ......

[C/C++ Digestion] – ×Ôµ×ÏòÉϵØ̽¾¿Ð麯Êý


[C/C++ Digestion] –
×Ôµ×ÏòÉϵØ̽¾¿Ð麯Êý
×÷Õߣº
Jason Lee @
http://blog.csdn.net/jasonblog
ÈÕÆÚ£º
2010-05-19
»·¾³£º
Visual C++ Express
2008
ÉùÃ÷£º±¾ÎÄ·¢±íÔÚ
csdn
²©¿Í£¬ÈçÓÐתÔØ£¬Çë×¢Ã÷³ö´¦
 
[1]C++
¶ÔÏóÄ£ÐÍ»ù´¡
Ò»¸öÀàÖпÉÒÔ°üº¬¾²Ì¬Êý¾Ý³ÉÔ±¡¢¾²Ì¬³ÉÔ±º¯Êý¡¢·Ç¾²Ì¬³ÉÔ±º¯Êýº ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ