The C Programming Language
To be continued...
µÚ8Õ UNIXϵͳ½Ó¿Ú
#include <stdio.h>
#include <fcntl.h>
#include "syscalls.h"
#defien PERMS 0666
void error(char *, ...);
/* cpº¯Êý: ½« f1 ¸´ÖƵ½ f2 */
int main(int argc, char *argv[])
{
int f1, f2, n;
char buf[BUFSIZ];
if (argc != 3)
error("Usage: c from to");
if ((f1 = open(argv[1], O_RDONLY, 0)) == -1)
error("cp: can't open %s", argv[1]);
if ((f2 = creat(argv[2], PERMS)) == -1)
error("cp: can't create %s, mode %03o", argv[2], PERMS);
while ((n = read(f1, buf, BUFSIZ)) > 0)
if (write(f2, buf, n) != n)
error("cp: write error on file %s", argv[2]);
return 0;
}
#include <stdio.h>
#include <stdarg.h>
/* errorº¯Êý: ´òÓ¡Ò»¸ö³ö´íÐÅÏ¢£¬È»ºóÖÕÖ¹ */
void error(char *fmt, ...)
{
va_list args;
va_start(args, fmt);
fprintf(stderr, "error:");
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
va_end(args);
exit (1);
}
Ïà¹ØÎĵµ£º
#include <windows.h>
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd )
{
OPENFILENAME ofn;
//ÔÚÄÚ´æÖпª±ÙÒ»¿é¿Õ¼ä£¬´æ·ÅÓû§Ñ¡È¡µÄÎļþÃû
char szFile[MAX_PATH];//MAX_PATH ......
×óÖµÐÔ£¨lvalueness£©ÔÚC/C++ÖÐÊDZí´ïʽµÄÒ»¸öÖØÒªÊôÐÔ¡£Ö»ÓÐͨ¹ýÒ»¸ö×óÖµ±í´ïʽ²ÅÄÜÀ´ÒýÓü°¸ü¸ÄÒ»¸ö¶ÔÏó£¨object£©µÄÖµ¡££¨Ä³Ð©Çé¿öÏ£¬ÓÒÖµ±í´ïʽҲÄÜÒýÓã¨refer£©µ½Ä³Ò»¸ö¶ÔÏ󣬲¢ÇÒ¿ÉÄܼä½ÓÐ޸ĸöÔÏóµÄÖµ£¬ºóÊö£©¡£
ºÎν¶ÔÏó£¿Èç¹ûûÓÐÃ÷ȷ˵Ã÷£¬ÕâÀï˵µÄ¶ÔÏ󣬺ÍÏÁÒåµÄÀà/¶ÔÏó£¨class/object£© ......
Ö¸ÕëÊÇcºÍc++ÖеÄÄѵãºÍÖص㡣ÎÒÖ»¾«Í¨dosϵÄbasic¡£cÓïÑÔµÄÆäËü¸÷ÖÖÌØÐÔ£¬ÔÚbasicÖж¼ÓÐÀàËƵĶ«Î÷¡£Ö»ÓÐÖ¸Õ룬ÊÇbaiscËù²»¾ß±¸µÄ¡£Ö¸ÕëÊÇcµÄÁé»ê¡£
ÎÒ²»ÏëÖظ´´ó¶àÊýÊéÉÏ˵µÃºÜÇå³þµÄ¶«Î÷£¬ÎÒÖ»ÊÇ°ÑÎÒ¿´¹ýµÄÊéÖÐ˵µÃ²»Çå³þ»òûÓÐ˵£¬¶øÎÒÓÖ¾õµÃÎÒÀí½âµÃÓеãµÀÀíµÄ¶«Î÷д³öÀ´¡£ÎÒµÄÄ¿µÄÊÇ£º
1¡£Í¨¹ýдÕâЩ¶«Î ......
ÔÚVC6ÖÐʹÓÃc API·½Ê½Á¬½ÓMySQLÊý¾Ý¿â
Ò»¡¢»·¾³ÅäÖÃ
1¡¢ÔÚMySqlµÄ¹Ù·½ÍøÕ¾ÏÂÔØmysql-connector-c-noinstall£¬²¢½«½âѹºóµÄbinºÍincludeÎļþ¼Ð¿½±´µ½MysqlµÄ°²×°Ä¿Â¼
2¡¢ÉèÖÃVC6»·¾³£¬ÔÚvc¹¤¾ß-Ñ¡Ïî-Ŀ¼£¬¼ÓÈë¸Õ²ÅµÄIncludeÎļþ¼ÐµÄ·¾¶£¬ÀýÈ磺C:\Program Files\MySQL\MySQL Server 5.1\include
¶þ¡¢¹¤³ÌÉèÖÃ
3¡¢½«li ......