VB 使用C语言Escape的方法
在C语言中,escape的符号很好用,
比如
"中国一定强"
这个字串可以写成:
"\x4E2D\x56FD\x4E00\x5B9A\x5F3A"
用字元编码编写程序,在其他不同语言的windows运作时,比较不会有问题。
(我尽量不想在程序中写入中文)
但是vb如果全部要用字元编码写的话,就会很麻烦而且一个一个都要手写成:
ChrW(&H4E2D) & ChrW(&H56FD) & ChrW(&H4E00) & ChrW(&H5B9A) & ChrW(&H5F3A)
所以我写了一条短短的function:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Function EscToStr(ByVal c As String) As String
Dim tmp, str1, str2, str3, str4 As String
Dim i, outend1, outend2 As Integer
i = 1
outend1 = 1
Do While outend1 <> 0
str1 = c
outend1 = InStr(i, str1, "\x")
i = outend1 + 1
outend2 = InStr(i, str1, "\x")
If outend2 = 0 Then
outend2 = Len(str1) + 1
End If
str2 = Mid(str1, outend1 + 2, outend2 - outend1 - 2)
str3 = "&H" & str2
str4 = ChrW(str3)
tmp = tmp &
相关文档:
ARM C嵌入式编程中的几个关键字
1、访问绝对地址的内存位置:
#define pISR_EINT0 (*(unsigned *) (_ISR_STRATADDRESS+0x74))
上述语句把无符号整数_ISR_STRATADDRESS+0x74强制转换为指针,指向RAM,用下面的语句可以访问它:
pISR_EINT0 = (int)Eint0_ISR
& ......
线型
-----------------------------------------------------
名 称 取 值 含 义
-----------------------------------------------------
SOLID_LINE 0 & ......
#include <iostream>
using namespace std;
class Base {
public:
virtual void fn(int x) {
cout << "In Base class, int x = " << x << endl;
}
};
class SubClass : public Base {
public:
// 函数的重载,这样的重载方式,在Java中能行,在C/C++中却不行
virt ......
1.fopen()
fopen的原型是:FILE *fopen(const char
*filename,const char
*mode),fopen实现三个功能:为使用而打开一个流,把一个文件和此流相连接,给此流返回一个FILR指针。
参数filename指向要打开的文件名,mode表示打开状态的字符串,其
取值如下:
字符串 含义
"r" 以只读方式打开 ......
操作步骤:
1.物理机安装VMWare,在虚拟机中安装Windows XP Professional + SP2
2.VM->Install VMware Tools...
3.在VMware主界面双击Ethernet,并选定Host-only选项
4.在物理机网络连接中,设置VMware Network Adapter VMnet1的IP地址为:130.0.0.50,子网掩码:255.255.0.0,其余为空,作为操作站使用。同时禁用VM ......