菜鳥求助(代碼轉化),請大家幫忙。。。
下面的代碼可不可以轉用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;
}