close
Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中 
我的程式怪怪的 求程式語言高手!!
Apr 3rd 2015, 15:08

我的作業是 form listBox openlistdiolog 也就是開檔讀檔
讀的是這個 他是.txt檔 我用的是visual C++ 2010 Exp
1234455
901065741
231
45689211963569
55289
10568944652
52123554
456221289
12355897
5246465132.1

這是我的程式
#include "stdafx.h";
#include "Form1.h";
#include <vcclr.h>;
using namespace System::Runtime::InteropServices;
float Blood_Pressure[100];
float ECG[100];
int datalength;
float xx;

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
String ^temp; String ^Ctemp; String ^Str;
orrno_t err;
int len; int Index;
FILE *fp; char *printout; int i;
float tempecg, tempbp; printout= new char [500];
openFileDialog^ openFileDialog = gcnew openFileDialog;// openFileDialog 變數名稱
openFileDialog1->InitialDirectory = "c:\\";
openFileDialog1->FilterInder = "txt files (*.txt)|*.txt|All files(*.*)|*.*";
openFileDialog1->FilterInder = 2;
openFileDialog1->RestoreDirectory = true;
if ( openFileDialogl->ShowDialog() == System::Windows::Forms::DialogResult::OK){
if (( openFileDialogl->openFile() )!= nullptr){
temp = openFileDialogl->FileName;
char* filename = (char*) Marshal::StringToHGlbalAnsi(temp).ToPointer(); i =0;
if (( err = fopen_s(&fp,filename,"rt"))==0) { //rt->read text 可看指令碼
for(int i=1;i<<11;i++){//讀十個檔案
fscanf_s(fp, " %f %f " , &tempecp, &tempbp);
sprintf_s(printout, 1500, "%d\t\t %4.4f \t\t %4.4f \n", i , tempecg , tempbp ); // 變成文字列到listbox
Ctemp = gcnew String( printout );
listBox1-> Items-> Add(Ctemp);
delete Ctemp;
Blood_Pressure[i]=tempbp;
ECG[i]=tempecg;
fclose(fp); }
}
}
};
)
偵錯時一直出現
1>------ 已開始建置: 專案: 功課 讀黨, 組態: Debug Win32 ------
1> 功課 讀黨.cpp
1>功課 讀黨.cpp(4): warning C4067: 未預期的語彙基元,接著前置處理器指示詞 - 必須是新行
1>功課 讀黨.cpp(5): warning C4067: 未預期的語彙基元,接著前置處理器指示詞 - 必須是新行
1>C:\Program Files (x86)\Microsoft V

This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 kkoki0httzobg 的頭像
    kkoki0httzobg

    線上遊戲排行榜2013/2014,進擊的巨人線上看,candy crush saga外掛,正妹寫真三圍

    kkoki0httzobg 發表在 痞客邦 留言(0) 人氣()