Новичок
Профиль
Группа: Участник
Сообщений: 8
Регистрация: 17.4.2012
Репутация: нет Всего: нет
|
Код | #pragma once
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include<stdio.h> #include <vector> #include "stdafx.h" using namespace std; #define BUFSIZE 1024 //char buffer [BUFSIZE]; namespace Картриджи { int a10=0; int a11=0; int a12=0; int a13=0; int a14=0; int a15=0; int a16=0; int a17=0; using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing;
/// <summary> /// Сводка для Form1 /// </summary> public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: добавьте код конструктора // }
protected: /// <summary> /// Освободить все используемые ресурсы. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::Button^ button1; private: System::Windows::Forms::MonthCalendar^ monthCalendar1; private: System::Windows::Forms::TextBox^ textBox1; private: System::Windows::Forms::TextBox^ textBox2; private: System::Windows::Forms::TextBox^ textBox3; private: System::Windows::Forms::TextBox^ textBox4; private: System::Windows::Forms::TextBox^ textBox5; private: System::Windows::Forms::TextBox^ textBox6; private: System::Windows::Forms::TextBox^ textBox7; private: System::Windows::Forms::TextBox^ textBox8; private: System::Windows::Forms::NumericUpDown^ numericUpDown1; private: System::Windows::Forms::NumericUpDown^ numericUpDown2; private: System::Windows::Forms::NumericUpDown^ numericUpDown3; private: System::Windows::Forms::NumericUpDown^ numericUpDown4; private: System::Windows::Forms::NumericUpDown^ numericUpDown5; private: System::Windows::Forms::NumericUpDown^ numericUpDown6; private: System::Windows::Forms::NumericUpDown^ numericUpDown7; private: System::Windows::Forms::NumericUpDown^ numericUpDown8; private: System::Windows::Forms::Button^ button2;
protected:
private: /// <summary> /// Требуется переменная конструктора. /// </summary> System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code /// <summary> /// Обязательный метод для поддержки конструктора - не изменяйте /// содержимое данного метода при помощи редактора кода. /// </summary> void InitializeComponent(void) { this->button1 = (gcnew System::Windows::Forms::Button()); this->monthCalendar1 = (gcnew System::Windows::Forms::MonthCalendar()); this->textBox1 = (gcnew System::Windows::Forms::TextBox()); this->textBox2 = (gcnew System::Windows::Forms::TextBox()); this->textBox3 = (gcnew System::Windows::Forms::TextBox()); this->textBox4 = (gcnew System::Windows::Forms::TextBox()); this->textBox5 = (gcnew System::Windows::Forms::TextBox()); this->textBox6 = (gcnew System::Windows::Forms::TextBox()); this->textBox7 = (gcnew System::Windows::Forms::TextBox()); this->textBox8 = (gcnew System::Windows::Forms::TextBox()); this->numericUpDown1 = (gcnew System::Windows::Forms::NumericUpDown()); this->numericUpDown2 = (gcnew System::Windows::Forms::NumericUpDown()); this->numericUpDown3 = (gcnew System::Windows::Forms::NumericUpDown()); this->numericUpDown4 = (gcnew System::Windows::Forms::NumericUpDown()); this->numericUpDown5 = (gcnew System::Windows::Forms::NumericUpDown()); this->numericUpDown6 = (gcnew System::Windows::Forms::NumericUpDown()); this->numericUpDown7 = (gcnew System::Windows::Forms::NumericUpDown()); this->numericUpDown8 = (gcnew System::Windows::Forms::NumericUpDown()); this->button2 = (gcnew System::Windows::Forms::Button()); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown1))->BeginInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown2))->BeginInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown3))->BeginInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown4))->BeginInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown5))->BeginInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown6))->BeginInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown7))->BeginInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown8))->BeginInit(); this->SuspendLayout(); // // button1 // this->button1->Location = System::Drawing::Point(291, 377); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(119, 44); this->button1->TabIndex = 0; this->button1->Text = L"Обновить"; this->button1->UseVisualStyleBackColor = true; this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click); // // monthCalendar1 // this->monthCalendar1->Location = System::Drawing::Point(573, 0); this->monthCalendar1->Name = L"monthCalendar1"; this->monthCalendar1->TabIndex = 1; // // textBox1 // this->textBox1->Enabled = false; this->textBox1->Location = System::Drawing::Point(99, 43); this->textBox1->Name = L"textBox1"; this->textBox1->Size = System::Drawing::Size(100, 20); this->textBox1->TabIndex = 2; this->textBox1->Text = L"Hello"; this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged); // // textBox2 // this->textBox2->Enabled = false; this->textBox2->Location = System::Drawing::Point(99, 69); this->textBox2->Name = L"textBox2"; this->textBox2->Size = System::Drawing::Size(100, 20); this->textBox2->TabIndex = 3; this->textBox2->Text = L"Hello"; // // textBox3 // this->textBox3->Enabled = false; this->textBox3->Location = System::Drawing::Point(99, 95); this->textBox3->Name = L"textBox3"; this->textBox3->Size = System::Drawing::Size(100, 20); this->textBox3->TabIndex = 4; this->textBox3->Text = L"Hello"; // // textBox4 // this->textBox4->Enabled = false; this->textBox4->Location = System::Drawing::Point(99, 121); this->textBox4->Name = L"textBox4"; this->textBox4->Size = System::Drawing::Size(100, 20); this->textBox4->TabIndex = 5; this->textBox4->Text = L"Hello"; // // textBox5 // this->textBox5->Enabled = false; this->textBox5->Location = System::Drawing::Point(99, 147); this->textBox5->Name = L"textBox5"; this->textBox5->Size = System::Drawing::Size(100, 20); this->textBox5->TabIndex = 6; this->textBox5->Text = L"Hello"; // // textBox6 // this->textBox6->Enabled = false; this->textBox6->Location = System::Drawing::Point(99, 173); this->textBox6->Name = L"textBox6"; this->textBox6->Size = System::Drawing::Size(100, 20); this->textBox6->TabIndex = 7; this->textBox6->Text = L"Hello"; // // textBox7 // this->textBox7->Enabled = false; this->textBox7->Location = System::Drawing::Point(99, 199); this->textBox7->Name = L"textBox7"; this->textBox7->Size = System::Drawing::Size(100, 20); this->textBox7->TabIndex = 8; this->textBox7->Text = L"Hello"; // // textBox8 // this->textBox8->Enabled = false; this->textBox8->Location = System::Drawing::Point(99, 225); this->textBox8->Name = L"textBox8"; this->textBox8->Size = System::Drawing::Size(100, 20); this->textBox8->TabIndex = 9; this->textBox8->Text = L"Hello"; // // numericUpDown1 // this->numericUpDown1->Location = System::Drawing::Point(261, 42); this->numericUpDown1->Name = L"numericUpDown1"; this->numericUpDown1->Size = System::Drawing::Size(120, 20); this->numericUpDown1->TabIndex = 10; // // numericUpDown2 // this->numericUpDown2->Location = System::Drawing::Point(261, 68); this->numericUpDown2->Name = L"numericUpDown2"; this->numericUpDown2->Size = System::Drawing::Size(120, 20); this->numericUpDown2->TabIndex = 11; // // numericUpDown3 // this->numericUpDown3->Location = System::Drawing::Point(261, 96); this->numericUpDown3->Name = L"numericUpDown3"; this->numericUpDown3->Size = System::Drawing::Size(120, 20); this->numericUpDown3->TabIndex = 12; // // numericUpDown4 // this->numericUpDown4->Location = System::Drawing::Point(261, 121); this->numericUpDown4->Name = L"numericUpDown4"; this->numericUpDown4->Size = System::Drawing::Size(120, 20); this->numericUpDown4->TabIndex = 13; // // numericUpDown5 // this->numericUpDown5->Location = System::Drawing::Point(261, 147); this->numericUpDown5->Name = L"numericUpDown5"; this->numericUpDown5->Size = System::Drawing::Size(120, 20); this->numericUpDown5->TabIndex = 14; // // numericUpDown6 // this->numericUpDown6->Location = System::Drawing::Point(261, 174); this->numericUpDown6->Name = L"numericUpDown6"; this->numericUpDown6->Size = System::Drawing::Size(120, 20); this->numericUpDown6->TabIndex = 15; // // numericUpDown7 // this->numericUpDown7->Location = System::Drawing::Point(261, 199); this->numericUpDown7->Name = L"numericUpDown7"; this->numericUpDown7->Size = System::Drawing::Size(120, 20); this->numericUpDown7->TabIndex = 16; // // numericUpDown8 // this->numericUpDown8->Location = System::Drawing::Point(261, 225); this->numericUpDown8->Name = L"numericUpDown8"; this->numericUpDown8->Size = System::Drawing::Size(120, 20); this->numericUpDown8->TabIndex = 17; // // button2 // this->button2->Location = System::Drawing::Point(480, 377); this->button2->Name = L"button2"; this->button2->Size = System::Drawing::Size(129, 43); this->button2->TabIndex = 18; this->button2->Text = L"Считывание"; this->button2->UseVisualStyleBackColor = true; this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click); // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(737, 446); this->Controls->Add(this->button2); this->Controls->Add(this->numericUpDown8); this->Controls->Add(this->numericUpDown7); this->Controls->Add(this->numericUpDown6); this->Controls->Add(this->numericUpDown5); this->Controls->Add(this->numericUpDown4); this->Controls->Add(this->numericUpDown3); this->Controls->Add(this->numericUpDown2); this->Controls->Add(this->numericUpDown1); this->Controls->Add(this->textBox8); this->Controls->Add(this->textBox7); this->Controls->Add(this->textBox6); this->Controls->Add(this->textBox5); this->Controls->Add(this->textBox4); this->Controls->Add(this->textBox3); this->Controls->Add(this->textBox2); this->Controls->Add(this->textBox1); this->Controls->Add(this->monthCalendar1); this->Controls->Add(this->button1); this->Name = L"Form1"; this->Text = L"Form1"; this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown1))->EndInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown2))->EndInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown3))->EndInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown4))->EndInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown5))->EndInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown6))->EndInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown7))->EndInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown8))->EndInit(); this->ResumeLayout(false); this->PerformLayout();
} #pragma endregion private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { }
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) { }
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { int d1 = (int)this->numericUpDown1->Value; int d2 = (int)this->numericUpDown2->Value; int d3 = (int)this->numericUpDown3->Value; int d4 = (int)this->numericUpDown4->Value; int d5 = (int)this->numericUpDown5->Value; int d6 = (int)this->numericUpDown6->Value; int d7 = (int)this->numericUpDown7->Value; int d8 = (int)this->numericUpDown8->Value;
FILE *stream; /* открыть файл для изменения */ stream = fopen("C:\\Users\\bilin.CS\\TextFile1.txt","w+"); /* вывести в файл данные */ fprintf(stream,"%d",d1); fprintf(stream,"%d ",d2); fprintf(stream,"%d ",d3); fprintf(stream,"%d ",d4); fprintf(stream,"%d ",d5); fprintf(stream,"%d ",d6); fprintf(stream,"%d ",d7); fprintf(stream,"%d ",d8); /* закрыть файл */ fclose(stream); if(stream == NULL){ perror("Couldn't open file: C:\\ro_apps\\IandQ.csv\n"); return;
} } private: System::Void listBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) { } private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) { /*FILE *stream; stream = fopen("C:\\Users\\bilin\\TextFile1.txt","r");
if(stream) { while(!feof(stream)) { fgets(buffer, BUFSIZE, stream);
} } */ char* filename="C:\\Users\\bilin\\TextFile1.txt";
std::vector<int> read(std::string const& filename ) {
std::vector<int> result; int buffer = 0; FILE* stream = std::fopen(filename.c_str(), "r"); while (std::fscanf(stream, "%d", &buffer) != EOF) { result.push_back(buffer); } std::fclose(stream); return result; }
/* a10= buffer[1]; a11= buffer[2]; a12= buffer[3]; a13= buffer[4]; a14= buffer[5]; a15= buffer[6]; a16= buffer[7]; a17= buffer[8];
this->numericUpDown1->Value = a10; this->numericUpDown2->Value = a11; this->numericUpDown3->Value = a12; this->numericUpDown4->Value = a13; this->numericUpDown5->Value = a14; this->numericUpDown6->Value = a15; this->numericUpDown7->Value = a16; this->numericUpDown8->Value = a17; */
} };
}
|
Добавлено через 36 секундстрока 374 ошибку пишет
|