Ò»¸öC++µ÷ÓÃCµÄÀý×Ó
//cExample.h
#ifndef C_EXAMPLE_H
#define C_EXAMPLE_H
#ifdef __cplusplus
extern "C"
{
#endif
int add(int x, int y);
#ifdef __cplusplus
}
#endif
#endif
---------------------------------
//cExample.c
#include"cExample.h"
int add(int x, int y)
{
return x + y;
}
---------------------------------
//cppFile.cpp
#include <iostream>
#include"cExample.h"
using namespace std;
main()
{
cout<<add(2,3)<<endl;
return 0;
}
--------------------------------
//makefile
cppFile: cppFile.o cExample.o
g++ -g -o cppFile cppFile.o cExample.o
cppFile.o: cppFile.cpp
g++ -g -c cppFile.cpp
cExample.o: cExample.c cExample.h
gcc -g -c cExample.c
clean:
rm -f *.o cppFile
Ïà¹ØÎĵµ£º
ÔÚCÓïÑÔÖУ¬escapeµÄ·ûºÅºÜºÃÓã¬
±ÈÈç
"ÖйúÒ»¶¨Ç¿"
Õâ¸ö×Ö´®¿ÉÒÔд³É£º
"\x4E2D\x56FD\x4E00\x5B9A\x5F3A"
ÓÃ×ÖÔª±àÂë±àд³ÌÐò£¬ÔÚÆäËû²»Í¬ÓïÑÔµÄwindowsÔË×÷ʱ£¬±È½Ï²»»áÓÐÎÊÌâ¡£
£¨ÎÒ¾¡Á¿²»ÏëÔÚ³ÌÐòÖÐдÈëÖÐÎÄ£©
µ«ÊÇvbÈç¹ûÈ«²¿ÒªÓÃ×ÖÔª±àÂëдµÄ»°£¬¾Í»áºÜÂé·³¶øÇÒÒ»¸öÒ»¸ö¶¼ÒªÊÖд³É£º
ChrW(&H4E2D) ......
1.·Ö²ãÉè¼Æ£¬¸ôÀëÆ½Ì¨Ïà¹ØµÄ´úÂë¡£¾ÍÏñ¿É²âÊÔÐÔÒ»Ñù£¬¿ÉÒÆÖ²ÐÔÒ²Òª´ÓÉè¼Æ×¥Æð¡£Ò»°ãÀ´Ëµ£¬×îÉϲãºÍ×îϲ㶼²»¾ßÓÐÁ¼ºÃµÄ¿ÉÒÆÖ²ÐÔ¡£×îÉϲãÊÇGUI£¬´ó¶àÊýGUI¶¼²»ÊÇ¿çÆ½Ì¨µÄ£¬ÈçWin32 SDKºÍMFC¡£×îϲãÊDzÙ×÷ϵͳAPI£¬´ó¶à²¿·Ö²Ù×÷ϵͳAPI¶¼ÊÇרÓõġ£
¡¡¡¡Èç¹ûÕâÁ½²ãµÄ´úÂëÉ¢²¼ÔÚÕû¸öÈí¼þÖУ¬ÄÇôÕâ¸öÈí¼þµÄ¿ÉÖ²ÐÔ½«·Ç³£µÄ² ......
²âÊÔ´úÂëÒ»£¨VC6.0¡¢C-code£©£º
#include <stdio.h>
void main()
{
int aa;
unsigned char j1,j2;
aa=j1=j2=0;
aa=49;
j1=aa;
printf("j1=%d \n",j1);
j2=aa;
printf("j2=%c \n",j2);
}
¡¾·ÖÎö¡¿£º
[1]ÕýÈçËùÏëÏóµÄÊä³ö½á¹û£º
j1 ......
Ò»¡¢¿ª·¢»·¾³
1¡¢ windowsXP
2¡¢ mysql 5.0.22
3¡¢ Dev-C++ 4.9.9.2
4¡¢ ÏÂÔØ(mysqlpp-2.3.2-gcc3.4.2-1due.DevPak)
5¡¢ MySQL.DevPak ÏÂÔØµØÖ·£º http://downloads.sourceforge.net/dev-cpp/MySQL.DevPak
6¡¢ ÏÂÔØÒÔºóͨ¹ý‘¹¤¾ß[T]’ --> ´ò ......
(ת)C/C++ÖеÄÈÕÆÚºÍʱ¼ä time_tÓëstruct tmת»»
ͻ񻣼
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼ÆÊ±¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê ......