VC .NETÖÐString^ ÓëANSI C char*»¥×ª
VC.NETÖеÄStringÀàÊÇÀûÓÃUnicode×Ö·û¼¯±àÂëÀ´±íʾÎı¾¡£Unicode×Ö·û¼¯ÖÐÿ¸ö×Ö·û(ºº×Ö¡¢Ó¢ÎÄ×Öĸ)¶¼Õ¼2¸ö×Ö½Ú£¬ÇÒÆä×Ö·û´®ÊÇÒÔ2¸öÁ¬ÐøµÄ\0½áβµÄ¡£
ANSIµÄASCII×Ö·û¼¯ÊÇ×î³£¼ûµÄ×Ö·û¼¯£¬³£ÓÃÓÚ±íʾtxtµÄÎı¾Îļþ¡£ÔÚASCII×Ö·û¼¯ÖÐÓ¢ÎÄÕ¼Ò»¸ö×Ö½Ú£¬ºº×Ö2¸ö×Ö½Ú£¬ÇÒÆä×Ö·û´®ÊÇÒÔÒ»¸ö\0½áβµÄ¡£
ÔÚÀûÓÃVC.NET½øÐлìºÏ±à³Ìʱ£¬¾³£ÐèҪʵÏÖStringÓëchar*µÄ»¥×ª£¬ÀýÈçÔÚTextBox¿Ø¼þÖÐÊäÈëµÄText×÷Ϊfopen»òÕßCreateFileµÄÎļþÃû²ÎÊýʱ£¬³£ÐèҪʵÏÖchar*µÄת»¯¡£¹ÊÌṩÈçϵÄת»¯·½·¨£º
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
int main(array<System::String ^> ^args)
{
// String^ converts to char*
char szDestOutChar[256];
String^ SrcInStr = "C:\\Documents and Settings\\Adiminstrator\\ÎÒµÄÎĵµ\\swq.txt";
int SourceStrLen = SrcInStr->Length;
wchar_t *pwszStr = new wchar_t[SourceStrLen + 1];
array <System::Char>^ pClr = SrcInStr->ToCharArray();
for (int i = 0; i < SourceStrLen; i++)
{
pwszStr[i] = pClr[i];
}
pwszStr[SourceStrLen] = '\0';
::WideCharToMultiByte(CP_ACP, NULL, pwszStr, -1, szDestOutChar, 256, NULL, NULL);
// char* converts to String^
char* szInSrcChar = "C:\\Documents and Settings\\Adiminstrator\\ÎÒµÄÎĵµ\\swq.txt";
int wcsLen = ::MultiByteToWideChar(CP_ACP, NULL, szInSrcChar, strlen(szInSrcChar), NULL, 0);
wchar_t* wszStr = new wchar_t[wcsLen + 1];
::MultiByteToWideChar(CP_ACP, NULL, szInSrcChar, strlen(szInSrcChar), wszStr, wcsLen);
wszStr[wcsLen] = '\0';
String^ ClrOutStr = gcnew String(wszStr);
System::Console::WriteLine("Press ENTER key to exit !");
System::Console::Read();
delete pwszStr;
delete wszStr;
return 0;
}
Ïà¹ØÎĵµ£º
//linuxϱàÒëg++ $(mysql_config --cflags) ***.cpp $(mysql_config --libs)
/*mysqlÊý¾Ý¿âÖбíµÄÄÚÈÝ
mysql> select * from maindb;
+------------------+---------+-------------+---------+----------+---------------------+---------------------+---------------------+------------------- ......
curl c api
¹ØÓÚCurlµÄ½éÉܺܶ࣬ÕâÀï²»Ïêϸ½éÉÜ£¬Ö÷Ҫ̸һϼòµ¥Ó¦Óá£
×î½üÑо¿ÁËÒ»ÏÂLinuxϵÄcurl C API,curl c APIµÄÎĵµ±È½Ï·á¸»£¬Î¨Ò»¾ÍÊDzéÕÒÆðÀ´£¬·ÑЩʱ¼ä¡£CurlµÄC APIºÍcurlµÄPHP API£¬º¯Êý½Ó¿ÚºÍ×÷ÓôóÖÂÏàͬ£¬ËùÒÔÈç¹ûÓÐPHP APIʹÓþÑéÓ¦¸ÃºÜºÃÀí½â¡£
1£ºCURLcode curl_global_init(long flags);º¯ ......
vaϵÁкêµÄÓ÷¨µÄÒ»°ã²½Ö裺
vsptr(char *format, ...) //ÇмǴ˴¦µÄ¸ñʽ
{
va_list argptr;
va_start(argptr, format); //ʹµÃargptrÖ¸ÏòÒÔformat¿ªÍ·µÄ´æ´¢¿Õ¼ä
va_arg(argptr, type); //È¡´«µÝµÄ²ÎÊý
......
ÒÔÏ·ÖÎö»ùÓÚ£º
Developer Platform :S60 3rd Edition, Feature Pack 2 SDK
Operating System :Symbian OS v9.3
Ò»£¬ÎªÊ²Ã´ÒªÊ¹ÓÃClient/Server¼Ü¹¹
ÔÚSymibian OSÖÐËùÓеÄÒì²½·þÎñ¶¼ÊÇServerͨ¹ýC/S¼Ü¹¹À´ÊµÏֵġ£ClientÊÇÀûÓÃServerÌṩµÄÌض¨·þÎñµÄ³ÌÐò£¬Server½ÓÊÜÀ´ÖÁClientµÄÇëÇóÏûÏ¢²¢Í¬²½»òÒì²½µ ......