公司最近要用VC做一个(扩展储存过程).dll的文件,用SQL调用,请各位老大帮忙把这段PB代码改成VC(扩展储存过程).dll的代码.
//string of_encrypt(string as_source)
long i
long ll_len
string ls_text
string ls_result
ls_text = trim(as_source)
ll_len = len(ls_text)
ls_result = ""
ls_text = reverse(ls_text)
FOR i = 1 TO ll_len
ls_result = ls_result + char(asc(mid(ls_text,i,1)) + ((ll_len - i - 2) * 2))
NEXT
RETURN ls_result
------解决方案--------------------
漏了一行,呵呵
int i ;
int ll_len ;
CString ls_text ;
CString ls_result = "" , ls_tmp ;
char ch ;
ls_text = as_source ;
ls_text.TrimRight() ;
ll_len = ls_text.GetLength() ;
ls_text.MakeReverse() ;
for(i=0;i <ll_len;i++)
{
ch = ls_text.GetAt(i) ;
ch += (ll_len - i - 2) * 2 ;
ls_tmp.Format("%c",ch) ;
ls_result += ls_tmp ;
}
return ls_result ;
------解决方案--------------------
你只include下面三个头文件试试
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
malloc和free方法应该都在malloc.h头文件中定义。
afx.h是MFC的头文件。