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

µÚÒ»¸öpro*C demo

¸Ã³ÌÐòºÜ¼òµ¥£¬¾ÍÊÇÓÃC´ÓORACLE£¬°Ñµ±Ç°ÈÕÆÚÏÔʾ³öÀ´¾ÍOK£¬×÷Ϊһ¸ö¼òµ¥µÄDEMO
£¨Ò»£©Ð´PRO*C
/*===========================================================================
* pro*c±àÒë·½·¨£º
* Ô¤±àÒë proc test.pc
* ±àÒë   gcc -o test test.c $ORACLE_HOME/lib/libclntsh.so
* ×÷Õß   foxliu
* ʱ¼ä   2009-10
*============================================================================*/
#include <stdio.h>
#include <sqlca.h>
int main(int argc,char **argv)
{
     /*ÉùÃ÷SQL±äÁ¿*/
     EXEC SQL BEGIN DECLARE SECTION;
  /*VARCHARÔ¤±àÒëºóΪstruct { unsigned short len; unsigned char arr[20];}*/
     VARCHAR user[20],pass[20],tnsname[20];
    
  char crruentDate[15];
     EXEC SQL END DECLARE SECTION;
    
     /*ÉùÃ÷C±äÁ¿*/
     int i=0;
     
    
     strcpy(user.arr,"dbrevass");
     user.len=strlen((char *)user.arr);
     strcpy(pass.arr,"dbrevass");
     pass.len=strlen((char *)pass.arr);
     strcpy(tnsname.arr,"wapp");
     tnsname.len=strlen((char *)tnsname.arr);
     /*Connect the DB*/
     EXEC SQL CONNECT :user IDENTIFIED BY :pass USING :tnsname;
     /*printf("%d",sqlca.sqlcode);*/
  /*ÓαêÉùÃ÷*/
     EXEC SQL declare emp_cursor cursor for
                                          select sysdate from dual;
            &n


Ïà¹ØÎĵµ£º

ÓÃCÉè¼Æ£¬ÓÃC++±àÂë

ÍøÓѹ۵ã:
(Ò»): 
ÎÒÈÏΪºÜ¶àÈËûÓÐÀí½âlinus»òÕßmyanµÄÒâ˼£¬ÎÒ¾Ù¸öʵÀý¡£
ÎÒÃÇÏÖÔÚÒªÉè¼ÆÒ»Ì×ÍøÂ磭¿Í»§¶ËÈí¼þ£¬ÎÒÃÇÒªÏÈ°ÑЭÒ鶨ºÃ£¬°Ñ½çÃæºÍºǫ́½»»¥Éè¼ÆÏëºÃ£¬°ÑÈÝ´íºÍ»Ö¸´ÏëºÃ£¬ÎÒÈÏΪÕâЩÊÇ×îÖØÒªµÄ£¬ÖÁÓÚ±àÂ룬ÓÃCÒ²¿ÉÒÔ±à³öÀ´£¬ÓÃC£«£«Ò²¿ÉÒÔ±à³öÀ´£¬ÉõÖÁÓÃJAVAÒ²Äܱà³öÀ´£¬¹Ø¼üÊÇÕû¸öÈí¼þµÄ¼Ü¹¹ÒªÇåÎú£¬Õ ......

CÖеĿɱä²ÎÊýÑо¿

 CÖеĿɱä²ÎÊýÑо¿  
  
  Ò»£®  ºÎν¿É±ä²ÎÊý  
  int   printf(const   char*   format,   ...);    
  ÕâÊÇʹÓùýCÓïÑÔµÄÈËËùÔÙÊìϤ²»¹ýµÄprintfº¯ÊýÔ­ÐÍ£¬ËüµÄ²ÎÊýÖоÍÓй̶¨²ÎÊýformat ......

[zz] C/C++³ÌÐòԱӦƸ³£¼ûÃæÊÔÌâÉîÈëÆÊÎö £¨Ò»£©

 1.ÒýÑÔ ¡¡¡¡
      ±¾ÎĵÄд×÷Ä¿µÄ²¢²»ÔÚÓÚÌṩC/C++³ÌÐòÔ±ÇóÖ°ÃæÊÔÖ¸µ¼£¬¶øÖ¼ÔÚ´Ó¼¼ÊõÉÏ·ÖÎöÃæÊÔÌâµÄÄÚº­¡£ÎÄÖеĴó¶àÊýÃæÊÔÌâÀ´×Ô¸÷´óÂÛ̳£¬²¿·ÖÊÔÌâ½â´ðÒ²²Î¿¼ÁËÍøÓѵÄÒâ¼û¡£
      Ðí¶àÃæÊÔÌâ¿´ËƼòµ¥£¬È´ÐèÒªÉîºñµÄ»ù±¾¹¦²ÅÄܸø³öÍêÃÀµÄ½â´ð¡£ÆóÒµÒªÇóÃæÊÔ ......

C/C++±à³Ì¼¼ÄÜ¡¾ÕûÀí¡¿

Ô¤´¦ÀíÆ÷£¨Preprocessor£©
1. ÓÃÔ¤´¦ÀíÖ¸Áî#define ÉùÃ÷Ò»¸ö³£Êý£¬ÓÃÒÔ±íÃ÷1ÄêÖÐÓжàÉÙÃ루ºöÂÔÈòÄêÎÊÌ⣩
#define SECONDS_PER_YEAR (60 * 60 * 24 * 365)UL
ÎÒÔÚÕâÏë¿´µ½¼¸¼þÊÂÇ飺
1). #define Óï·¨µÄ»ù±¾ÖªÊ¶£¨ÀýÈ磺²»ÄÜÒԷֺŽáÊø£¬À¨ºÅµÄʹÓ㬵ȵȣ©
2). ¶®µÃÔ¤´¦ÀíÆ÷½«ÎªÄã¼ÆËã³£Êý±í´ïʽµÄÖµ£¬Òò´Ë£¬Ö±½Ó ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ