菜鳥求助(代碼轉化),請大家幫忙。。。

jackyhyoung 2005-08-25 05:33:49
下面的代碼可不可以轉用C語言或者是CVI來寫,各位大俠請幫幫忙寫一下,多謝。。
private: System::Void Form1_Load(System::Object * sender, System::EventArgs * e)
{
//**** Read INI

String* fileName;
String* add;
String* line;
int platform;

// create the application path and name
fileName = String::Concat( Directory::GetCurrentDirectory(), S"\\add.ini");

//Check INI Existence
if (File::Exists(fileName)) //Exist
{
FileStream* fs = new FileStream(fileName, FileMode::Open);
StreamReader* sr = new StreamReader(fs);


if (sr->Peek() >= 0) //Loop until end of file
{
line = sr->ReadLine();
if ( parseItemValue(line)->Length > 0 )
{
this->txtAddress->Text = parseItemValue(line);
}
else
{
MessageBox::Show(S"INI File Corrupted!");
this->btnDownload->Enabled = false;
}
}
fs->Close();
sr->Close();
fs = NULL;
sr = NULL;
}
else
{
MessageBox::Show(S"INI File Corrupted!");
this->btnDownload->Enabled = false;
}
//==================
String* getFileNameFrPath(String* path)
{
String* result;
int ptr;

ptr = path->LastIndexOf(S"\\");

result = path->Substring(ptr+1);
result = String::Concat(Directory::GetCurrentDirectory(),S"\\", result );
return result;
}
...全文
47 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jackyhyoung 2005-08-25
  • 打赏
  • 举报
回复
private: System::String* parseItemValue(String* line)
{
int length;
int i;
bool stop;


length = line->Length;
i = 0;
do
{
if ( line->Substring(i,1)->Equals( S"=") )
{
stop = true;
}
else
{
i++;
}

}while (stop == false );

return line->Substring(i+1, length-i-1);

}
jackyhyoung 2005-08-25
  • 打赏
  • 举报
回复
private: System::String* parseItemValue(String* line)
{
int length;
int i;
bool stop;


length = line->Length;
i = 0;
do
{
if ( line->Substring(i,1)->Equals( S"=") )
{
stop = true;
}
else
{
i++;
}

}while (stop == false );

return line->Substring(i+1, length-i-1);

}

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧