C rule
Àý) Σ険¤Ê¥³ー¥Ç¥£¥ó¥°
1 char cStr[256];
2 ZeroMemory(cStr, sizeof(cStr));
3 strcpy(cStr, src); ← src¤Î¥µ¥¤¥º¤¬256¥Ð¥¤¥È¤ò³¬¤¨¤Æ¤¤¤¿場ºÏ¥ªー¥Ðー¥Õ¥íー£¡
ÐÞÕý)
1 char cStr[256];
2 ZeroMemory(cStr,0, sizeof(cStr));
3 strncpy(cStr, src, sizeof(cStr)-1);
Σ険¤Ê関Êý
´úÌæ関Êý
gets
fgets
strcat
strncat
strcpy
strncpy
sprintf
snprintf
vsprintf
vsnprintf
Σ険¤ÊÀý)
#include <stdlib.h>
main (int argc, char* argv[]) {
printf(argv[1]);
}
ÐÞÕýÀý)
#include <stdlib.h>
main (int argc, char* argv[]) {
printf("%s",argv[1]);
}
Σ険¤Ê関Êý
printf
sprintf
fprintf
vsprintf
snprintf
vsnprintf
¡ù書ʽÎÄ×ÖÁФδàÈõÐÔ
書ʽÎÄ×ÖÁУ¨¥Õ¥©ー¥Þ¥Ã¥È¥¹¥È¥ê¥ó¥°£©¤È¤Ï¡¢printf関ÊýµÈ¤ÇʹÓ䵤ì¤ë書ʽ¤òÖ¸¶¨¤¹¤ëÎÄ×ÖÁÐ
¤Î¤³¤È¤Ç¤¢¤ë¡£¥ê¥¹¥È¤ÎÀý¤Ç¤Ï¡¢ÈëÁ¦¤µ¤ì¤¿ÎÄ×ÖÁФΤßÖ¸¶¨¤µ¤ì¤Æ¤ª¤ê¡¢書ʽÎÄ×ÖÁФ¬Ê¡ÂÔ¤µ¤ì¤¿
ÐΤǺô¤Ó³ö¤µ¤ì¤Æ¤¤¤ë¡£
¥ê¥¹¥È)
#include <stdlib.h>
main (int argc, char* argv[]) {
printf(argv[1]);
}
ͨ³£¤ÎÎÄ×ÖÁФ¬ÈëÁ¦¤µ¤ì¤ë場ºÏ¤Ï問題¤Ê¤¤¤¬¡¢書ʽÎÄ×ÖÁФòº¬¤ó¤ÀÈëÁ¦¤òÓ뤨¤ë¤³¤È¤Ç¹¥撃¤¬¤Ç¤¤ë¡£
printf関Êý¤Ç¤Ï¡¢書ʽÎÄ×ÖÁФ¬Ö¸¶¨¤µ¤ì¤ë¤È¡¢対応¤¹¤ë変Êý¤¬ÒýÊý¤ÇÓ뤨¤é¤ì¤Æ¤¤¤ë¤â¤Î¤È¤·¤Æ
動×÷¤¹¤ë¤¿¤á¡¢ÏÂ図¤Î¤è¤¦¤Ë²»Õý¤Ê動×÷¤È¤Ê
Ïà¹ØÎĵµ£º
½â¾ö²½Ö裺
gylu@dell-desktop:~$ sudo apt-get install ckermit
ÏÔʾ°²×°¹ý³Ì
gylu@dell-desktop:~$gedit ~/.kermrc
ÊäÈëÏÂÃæÄÚÈݺ󱣴æ.kermrcÍ˳ö:
set line /dev/ttyS0
set speed & ......
CAPTION: ¹ØÓÚC/C++ÖÐÄÚ´æ¿Õ¼äµÄ»®·Ö
AUTHOR: aIsland Õª×ÔÖйúITʵÑéÊÒ
DATE: 2010-05-30
E-MAIL: aIsland@live.cn
QQ: 418662213
P.S.
1.Bolanlan|ËæÐÄhigh|aIsland Èý¸öÍøÃû¾ùΪ±¾ÈË
2.ÉùÃ÷aIsland ËùÊÕ¼µÄËùÓÐÎÄÕÂÆäÖø×÷Ȩ¶¼ÊôÓÚÔ´´×÷Õß
  ......
/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010Äê5ÔÂ8ÈÕ, ÏÂÎç2:47
*/
#include <iostream>
using namespace std;
void swap(int x, int y) {
cout << "x and y swap before : " << x << "\t" << y << endl;
int i = x;
x = y;
y = i; ......
ºÃ¾ÃÒÔÇ°×öµÄÒ»¸ö³ÌÐò£¬Ì°ÐIJßÂÔʵÏÖ±³°üÎÊÌ⣬cʵÏÖ¡£
×ܽáÔÚÕâÀÒÔ±¸ÒÔºóºÍ±ðÈ˲éÕÒ¡£
//±³°üÎÊÌâ
#include "stdio.h"
#define MAX 10
void main()
{
int w[MAX]={0,10,130,15,60,25}; //´æ·ÅÖÊÁ¿
int v[MAX]={0,30,5,10,20,25}; //´æ·Å¼ÛÖµ
flo ......