luaºÍcµÄ½»»¥
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
#include <iostream>
#include <string>
using namespace std;
int main()
{
//LuaʾÀý´úÂë
char *szLua_code =
"r = string.gsub(c_Str, c_Mode, c_Tag) --ËÞÖ÷¸øµÄ±äÁ¿ "
"u = string.upper(r)";
//LuaµÄ×Ö·û´®Ä£Ê½
char *szMode = "(%w+)%s*=%s*(%w+)";
//Òª´¦ÀíµÄ×Ö·û´®
char *szStr = "key1 = value1 key2 = value2";
//Ä¿±ê×Ö·û´®Ä£Ê½
char *szTag = "<%1>%2</%1>";
lua_State *L = luaL_newstate();
luaL_openlibs(L);
//°ÑÒ»¸öÊý¾ÝË͸øLua
lua_pushstring(L, szMode);
lua_setglobal(L, "c_Mode");
lua_pushstring(L, szTag);
lua_setglobal(L, "c_Tag");
lua_pushstring(L, szStr);
lua_setglobal(L, "c_Str");
//Ö´ÐÐ
bool err = luaL_loadbuffer(L, szLua_code, strlen(szLua_code),
"demo") || lua_pcall(L, 0, 0, 0);
if(err)
{
//Èç¹û´íÎó£¬ÏÔʾ
cerr 
Ïà¹ØÎĵµ£º
º¯ÊýÃû: stpcpy
¹¦ ÄÜ: ¿½±´Ò»¸ö×Ö·û´®µ½ÁíÒ»¸ö
ÓÃ ·¨: char *stpcpy(char *destin, char *source);
³ÌÐòÀý:
#include <stdio.h>
#include <string.h>
int main(void)
{
char string[10];
char *str1 = "abcdefghi";
stpcpy(string, str1);
& ......
µ½ÁËmain.c£¬Æäʵmain.cÖеĴ󲿷ֵÄÄÚÈÝÊǵ÷Óú¯ÊýÀ´ÊµÏÖ³õʼ»¯µÄ¹¤×÷£¬µ«ÊÇ»¹Êǽ«Ëü¿´ÍêÁË¡£ÏÂÃæ¾ÍÊÇ´úÂëÁË¡£Ö÷Òª²Î¿¼µÄÊÇlinuxÄÚºËÍêȫעÊÍ£¬ÔÚһЩ²»Ì«Ã÷°×µÄµØ·½£¬²Î¿¼ÍøÉϵĽéÉÜ¡£·Ï»°ÉÙ˵¡£»¹Óкܳ¤µÄ·°¡¡£Å¬Á¦°¡O(∩_∩)O~¡£
/*
* main.c¹¦ÄÜÃèÊö¡£
*/
//main.c³ÌÐòµÄÖ÷Òª¹¦ÄÜÊÇÀûÓÃsetup.s ......
½ö¹©Ñ§Ï°Ê¹Óãº
/*********************************************
* Name : prime.c
* Purpose : prime (ËØÊýÅжÏ)
* Author : zimo
* Date : 01/21/2010
* ******************************************/
#include<stdio.h>
int main()
{
int m , n ;
& ......
C/C++ÖнṹÌå(struct)֪ʶµãÇ¿»¯
³ö´¦£ºPConline 2005Äê03ÔÂ07ÈÕ ×÷Õߣº¹ÜÄþ ÔðÈα༣ºxietaoming
¡¡¡¡ÔÚÉÏÒ»¸ö½Ì³ÌÖÐÎÒÃÇÒѾ¼òµ¥µÄ²ûÊöÁËʲôÊǽṹÌåÁË£¬ÎªÁ˽øÒ»²¿µÄѧϰ½á¹¹ÌåÕâÒ»ÖØÒªµÄ֪ʶµã£¬ÎÒÃǽñÌìÀ´Ñ§Ï°Ò»ÏÂÁ´±í½á¹¹¡£
¡¡¡¡½á¹¹Ìå¿ÉÒÔ¿´×öÊÇÒ»ÖÖ×Ô¶¨ÒåµÄÊý¾ÝÀàÐÍ£¬Ëü»¹ÓÐÒ»¸öºÜÖØÒªµÄÌØÐÔ£¬¾ÍÊǽ ......
C/C++ÖнṹÌå(struct)֪ʶµãÇ¿»¯(¶þ)
³ö´¦£ºPConline 2005Äê03ÔÂ07ÈÕ ×÷Õߣº¹ÜÄþ ÔðÈα༣ºxietaoming
¡¡¡¡Ê×ÏÈ£¬ÎÒÃÇдÕâ¸ö³ÌÐò£¬Òª¿¼Âǵ½ÓÉÓÚÊÇÒ»¸öÁ´±í½á¹¹£¬ÎÒÃDz»¿ÉÄÜÖªµÀËüµÄ´óСµ½µ×ÊǶà´ó£¬Õâ¸öÎÊÌâÎÒÃÇ¿ÉÒÔÓö¯Ì¬¿ª±Ù¶ÑÄÚ´æÀ´½â¾ö£¬ÒòΪ¶ÑÄÚ´æÔÚ³ÌÐò½áÊøÇ°Ê¼ÖÕÊÇÓÐЧµÄ£¬²»Êܺ¯ÊýÕ»¿Õ¼äÉúÃüÆÚµÄÏÞÖÆ£¬ ......