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

C/C++——С±à̸CÓïÑÔº¯ÊýÄÇЩÊÂ(16)

 C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1.      qsortº¯Êý
qsortº¯ÊýµÄ¹¦ÄÜÊÇʹÓÿìËÙÅÅÐòÀý³Ì½øÐÐÅÅÐò£¬ÆäÓ÷¨Îª£ºvoid qsort(void *base, int nelem, int width, int (*fcmp)());³ÌÐòʵÀýÈçÏ£º
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int sort_function( const void *a, const void *b);
char list[5][4] = { "cat", "car", "cab", "cap", "can" };
 
int main(void)
{
   int  x;
   qsort((void *)list, 5, sizeof(list[0]), sort_function);
   for (x = 0; x < 5; x++)
      printf("%s\n", list[x]);
   return 0;
}
int sort_function( const void *a, const void *b)
{
   return( strcmp(a,b) );
}
 
2.      putwº¯Êý
putwº¯ÊýµÄ¹¦ÄÜÊÇ°ÑÒ»×Ö·û»ò×ÖË͵½Á÷ÖУ¬ÆäÓ÷¨Îªint putw(int w, FILE *stream);³ÌÐòʵÀý´úÂëÈçÏ£º
#include <stdio.h>
#include <stdlib.h>
#define FNAME "test.$$$"
int main(void)
{
   FILE *fp;
   int word;
   fp = fopen(FNAME, "wb");
   if (fp == NULL)
   {
      printf("Error opening file %s\n", FNAME);
      exit(1);
   }
   word = 94;
   putw(word,fp);
   if (ferror(fp))
       printf("Error writing to file\n");
   else
       printf("Successful write\n");
   fclose(fp);
   fp = fopen(FNAME, "rb");
   if (fp == NULL)
   {
      printf("Error opening file %s\n", FNAME);
      exit(1);
   }
   word = getw(fp);
   if (ferror(fp))
       printf("Error reading file\n");
   else
 &nbs


Ïà¹ØÎĵµ£º

Symbian C/S »úÖÆ·ÖÎö

 
ÒÔÏ·ÖÎö»ùÓÚ£º
Developer Platform :S60 3rd Edition, Feature Pack 2 SDK
Operating System :Symbian OS v9.3
Ò»£¬ÎªÊ²Ã´ÒªÊ¹ÓÃClient/Server¼Ü¹¹
ÔÚSymibian OSÖÐËùÓеÄÒì²½·þÎñ¶¼ÊÇServerͨ¹ýC/S¼Ü¹¹À´ÊµÏֵġ£ClientÊÇÀûÓÃServerÌṩµÄÌض¨·þÎñµÄ³ÌÐò£¬Server½ÓÊÜÀ´ÖÁClientµÄÇëÇóÏûÏ¢²¢Í¬²½»òÒì²½µ ......

ʹÓÃEclipse+MinGW¹¹½¨WindowsÉϵÄC/C++¿ª·¢»·¾³

Ç°ÑÔ
Eclipse×÷Ϊһ¿î¼«ÆäÓÅÐãµÄJava IDE£¬ÒѾ­µÃµ½¹ã·ºµÄÈÏ¿É¡£µ±È»Eclipse²¢²»ÏÞÓÚJava¿ª·¢£¬ÓÉÓÚÆäÓÅÐãµÄ»ù´¡¼Ü¹¹£¬EclipseÒѾ­³ÉΪһ¸ö¿ÉÒÔÈÝÄÉÒ»ÇÐÓ뿪·¢ÓйصŤ¾ßµÄƽ̨¡£
µ±È»ÈÝÄÉÒ»Çв¢²»Òâζ×ÅÊʺÏÓÚÒ»ÇС£ÏñC/C++ÕâÑùÔç¾Í´æÔڵIJ¢¹ã·ºÓ¦ÓõÄÓïÑÔ£¬Ôç¾ÍÓÐÒ»´óÅú¿ÉÓõÄIDE£¬Ò²ÓкܶàÈËϲ»¶ÓÃvi/emacs×÷Ϊ×Ô¼ºµÄ¿ ......

CºÍC++»ìºÏ±à³Ì(__cplusplusʹÓÃ)


µÚÒ»ÖÖÀí½â
±ÈÈç˵ÄãÓÃC++¿ª·¢ÁËÒ»¸öDLL¿â£¬ÎªÁËÄܹ»ÈÃCÓïÑÔÒ²Äܹ»µ÷ÓÃÄãµÄDLLÊä³ö(Export)µÄº¯Êý£¬ÄãÐèÒªÓÃextern "C"À´Ç¿ÖƱàÒëÆ÷²»ÒªÐÞ¸ÄÄãµÄ
º¯ÊýÃû¡£
ͨ³££¬ÔÚCÓïÑÔµÄÍ·ÎļþÖо­³£¿ÉÒÔ¿´µ½ÀàËÆÏÂÃæÕâÖÖÐÎʽµÄ´úÂ룺
#ifdef __cplusplus
extern "C" {
#endif
/**** some declaration or so *****/
#ifde ......

Hidden Tricks (C)(091121)

 ÇëÔËÐÐÏÂÃæµÄ´úÂ룬¹Û²ì½á¹û£¬ÓÐÈË˵ÔõôÊÇËÀÑ­»·£¬ÄãͬÒâÂð£¿ÎªÊ²Ã´£¿
 
#include
 <stdio.h>
int
 main()
{
  int
 i = 0;
  int
 name[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; ......

C/C++——С±à̸CÓïÑÔº¯ÊýÄÇЩÊÂ(14)

C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
 
1.       normvideoº¯Êý
 
mallocº¯ÊýµÄ¹¦ÄÜÊÇÑ¡ÔñÕý³£ÁÁ¶È×Ö·û£¬ÆäÓ÷¨Îª£ºvoid normvideo(void);³ÌÐòʵÀýÈçÏ£º
#include < ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ