Private Function BSTRtoLPSTR(sBSTR As String, b() As Byte, lpsz As Long) As Long Dim cBytes As Long 'Get the number of bytes in the string cBytes = LenB(sBSTR)
'Redim the array to hold it + 2 for Unicode null ReDim b(1 To cBytes + 2) As Byte
Dim sABSTR As String 'Set sABSTR to ASCII equivalent sABSTR = StrConv(sBSTR, vbFromUnicode)
'Get a long pointer to the string lpsz = StrPtr(sABSTR)
Dim cBytes As Long
'Get the number of bytes in the string
cBytes = LenB(sBSTR)
'Redim the array to hold it + 2 for Unicode null
ReDim b(1 To cBytes + 2) As Byte
Dim sABSTR As String
'Set sABSTR to ASCII equivalent
sABSTR = StrConv(sBSTR, vbFromUnicode)
'Get a long pointer to the string
lpsz = StrPtr(sABSTR)
CopyMemory b(1), ByVal lpsz, cBytes + 2
lpsz = VarPtr(b(1))
BSTRtoLPSTR = cBytesEnd Function
时,提示“子程序或函数没有定义”的错误啊!请问如何引用?
字符串
HFILE file;
char* c=NULL;
file=_lopen("name",0);
c=_lread(file,"读入的指针",数据块的大小");