本文介绍了C ++与C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
如何将该C ++函数转换为CSharp ..?我只是想学习c#编程的新手..
Hello Guys,
How can I convert this C++ function into CSharp..? I am just a newbie that want''s to learn c# programming..
short MES_EditConfig(char *Detail, char *aParameter)
{
FILE *fp;
char *fData;
char fTemp[80];
char prjdef[512];
long FileSize;
char sString[500];
long sIndx;
char *strCmp;
long sCnt;
char str_newDetail[50];
int len_newDetail;
int ErrorFlag=0;
char *strA, *strC;
GetProjectDir(prjdef);
sprintf(fTemp , "%s\\Config.ini", prjdef);
FileSize = GetFileData(fTemp, &fData);
sIndx=0;
sCnt=0;
strCmp = fData;
sprintf(str_newDetail, "%s%s\n", Detail, aParameter);
len_newDetail = strlen(str_newDetail);
while(sCnt<filesize-1)>
{
while(fData[sCnt]!=10 && sCnt<filesize-1)>
sCnt++;
CopyString(sString, 0, fData, sIndx, sCnt - sIndx);
if(!strncmp(sString, Detail, strlen(Detail)))
{
strA = malloc(sIndx+1);
strC = malloc(FileSize-sIndx);
CopyString(strA, 0, fData, 0, sIndx);
CopyString(strC, 0, fData, sCnt+1, -1);
sprintf(fData, "%s%s%s", strA, str_newDetail, strC);
ErrorFlag=1;
}
sCnt++;
sIndx = sCnt;
}
fp = fopen(fTemp, "w");
fputs(fData, fp);
fclose(fp);
return ErrorFlag;
}
推荐答案
这篇关于C ++与C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!