1 / 1 / 0
Регистрация: 11.12.2010
Сообщений: 76

StringToChar: identifier not found

09.06.2011, 13:25. Показов 1094. Ответов 0
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
#pragma once
 
#include <stdio.h>
#include <cmath>
#include <string.h>
#include <stdlib.h>
using namespace std;
namespace kursovaja {
 
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::Runtime::InteropServices;
 
    /// <summary>
    /// Summary for Form1
    ///
    /// WARNING: If you change the name of this class, you will need to change the
    ///          'Resource File Name' property for the managed resource compiler tool
    ///          associated with all .resx files this class depends on.  Otherwise,
    ///          the designers will not be able to interact properly with localized
    ///          resources associated with this form.
    /// </summary>
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
        Form1(void)
        {
            InitializeComponent();
            //
            //TODO: Add the constructor code here
            //
        }
 
    protected:
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        ~Form1()
        {
            if (components)
            {
                delete components;
            }
        }
    private: System::Windows::Forms::Button^  button1;
    protected: 
    private: System::Windows::Forms::Button^  button2;
 
    private: System::Windows::Forms::Label^  label1;
    private: System::Windows::Forms::Label^  label2;
    private: System::Windows::Forms::Label^  label3;
    private: System::Windows::Forms::TextBox^  textBox1;
    private: System::Windows::Forms::TextBox^  textBox2;
    private: System::Windows::Forms::TextBox^  textBox3;
    private: System::Windows::Forms::PictureBox^  pictureBox1;
    private: System::Windows::Forms::DataGridView^  dg1;
 
    private: System::Windows::Forms::MenuStrip^  menuStrip1;
    private: System::Windows::Forms::OpenFileDialog^  openFileDialog1;
    private: System::Windows::Forms::SaveFileDialog^  saveFileDialog1;
    private: System::Windows::Forms::DataGridViewTextBoxColumn^  Column1;
    private: System::Windows::Forms::DataGridViewTextBoxColumn^  Column2;
    private: System::Windows::Forms::ToolStripMenuItem^  saveToolStripMenuItem;
    private: System::Windows::Forms::ToolStripMenuItem^  loadToolStripMenuItem;
 
        /// <summary>
        /// Required designer variable.
        /// </summary>
        System::ComponentModel::Container ^components;
 
#pragma region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        void InitializeComponent(void)
        {
            this->button1 = (gcnew System::Windows::Forms::Button());
            this->button2 = (gcnew System::Windows::Forms::Button());
            this->label1 = (gcnew System::Windows::Forms::Label());
            this->label2 = (gcnew System::Windows::Forms::Label());
            this->label3 = (gcnew System::Windows::Forms::Label());
            this->textBox1 = (gcnew System::Windows::Forms::TextBox());
            this->textBox2 = (gcnew System::Windows::Forms::TextBox());
            this->textBox3 = (gcnew System::Windows::Forms::TextBox());
            this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
            this->dg1 = (gcnew System::Windows::Forms::DataGridView());
            this->Column1 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
            this->Column2 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
            this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
            this->saveToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
            this->loadToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
            this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
            this->saveFileDialog1 = (gcnew System::Windows::Forms::SaveFileDialog());
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->BeginInit();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->dg1))->BeginInit();
            this->menuStrip1->SuspendLayout();
            this->SuspendLayout();
            // 
            // button1
            // 
            this->button1->Location = System::Drawing::Point(268, 21);
            this->button1->Name = L"button1";
            this->button1->Size = System::Drawing::Size(75, 23);
            this->button1->TabIndex = 0;
            this->button1->Text = L"button1";
            this->button1->UseVisualStyleBackColor = true;
            this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
            // 
            // button2
            // 
            this->button2->Location = System::Drawing::Point(268, 50);
            this->button2->Name = L"button2";
            this->button2->Size = System::Drawing::Size(75, 23);
            this->button2->TabIndex = 1;
            this->button2->Text = L"button2";
            this->button2->UseVisualStyleBackColor = true;
            this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
            // 
            // label1
            // 
            this->label1->AutoSize = true;
            this->label1->Location = System::Drawing::Point(35, 21);
            this->label1->Name = L"label1";
            this->label1->Size = System::Drawing::Size(35, 13);
            this->label1->TabIndex = 3;
            this->label1->Text = L"label1";
            // 
            // label2
            // 
            this->label2->AutoSize = true;
            this->label2->Location = System::Drawing::Point(35, 48);
            this->label2->Name = L"label2";
            this->label2->Size = System::Drawing::Size(35, 13);
            this->label2->TabIndex = 4;
            this->label2->Text = L"label2";
            // 
            // label3
            // 
            this->label3->AutoSize = true;
            this->label3->Location = System::Drawing::Point(35, 74);
            this->label3->Name = L"label3";
            this->label3->Size = System::Drawing::Size(35, 13);
            this->label3->TabIndex = 5;
            this->label3->Text = L"label3";
            // 
            // textBox1
            // 
            this->textBox1->Location = System::Drawing::Point(94, 21);
            this->textBox1->Name = L"textBox1";
            this->textBox1->Size = System::Drawing::Size(100, 20);
            this->textBox1->TabIndex = 6;
            // 
            // textBox2
            // 
            this->textBox2->Location = System::Drawing::Point(94, 48);
            this->textBox2->Name = L"textBox2";
            this->textBox2->Size = System::Drawing::Size(100, 20);
            this->textBox2->TabIndex = 7;
            // 
            // textBox3
            // 
            this->textBox3->Location = System::Drawing::Point(94, 74);
            this->textBox3->Name = L"textBox3";
            this->textBox3->Size = System::Drawing::Size(100, 20);
            this->textBox3->TabIndex = 8;
            // 
            // pictureBox1
            // 
            this->pictureBox1->Location = System::Drawing::Point(38, 150);
            this->pictureBox1->Name = L"pictureBox1";
            this->pictureBox1->Size = System::Drawing::Size(409, 263);
            this->pictureBox1->TabIndex = 9;
            this->pictureBox1->TabStop = false;
            // 
            // dg1
            // 
            this->dg1->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
            this->dg1->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^  >(2) {this->Column1, this->Column2});
            this->dg1->Location = System::Drawing::Point(453, 2);
            this->dg1->Name = L"dg1";
            this->dg1->Size = System::Drawing::Size(240, 150);
            this->dg1->TabIndex = 10;
            // 
            // Column1
            // 
            this->Column1->HeaderText = L"Column1";
            this->Column1->Name = L"Column1";
            // 
            // Column2
            // 
            this->Column2->HeaderText = L"Column2";
            this->Column2->Name = L"Column2";
            // 
            // menuStrip1
            // 
            this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->saveToolStripMenuItem, 
                this->loadToolStripMenuItem});
            this->menuStrip1->Location = System::Drawing::Point(0, 0);
            this->menuStrip1->Name = L"menuStrip1";
            this->menuStrip1->Size = System::Drawing::Size(764, 24);
            this->menuStrip1->TabIndex = 11;
            this->menuStrip1->Text = L"menuStrip1";
            // 
            // saveToolStripMenuItem
            // 
            this->saveToolStripMenuItem->Name = L"saveToolStripMenuItem";
            this->saveToolStripMenuItem->Size = System::Drawing::Size(46, 20);
            this->saveToolStripMenuItem->Text = L"Save";
            this->saveToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::saveToolStripMenuItem_Click);
            // 
            // loadToolStripMenuItem
            // 
            this->loadToolStripMenuItem->Name = L"loadToolStripMenuItem";
            this->loadToolStripMenuItem->Size = System::Drawing::Size(47, 20);
            this->loadToolStripMenuItem->Text = L"Load";
            this->loadToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::loadToolStripMenuItem_Click);
            // 
            // openFileDialog1
            // 
            this->openFileDialog1->FileName = L"openFileDialog1";
            this->openFileDialog1->FileOk += gcnew System::ComponentModel::CancelEventHandler(this, &Form1::openFileDialog1_FileOk);
            // 
            // saveFileDialog1
            // 
            this->saveFileDialog1->FileOk += gcnew System::ComponentModel::CancelEventHandler(this, &Form1::saveFileDialog1_FileOk);
            // 
            // Form1
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(764, 467);
            this->Controls->Add(this->dg1);
            this->Controls->Add(this->pictureBox1);
            this->Controls->Add(this->textBox3);
            this->Controls->Add(this->textBox2);
            this->Controls->Add(this->textBox1);
            this->Controls->Add(this->label3);
            this->Controls->Add(this->label2);
            this->Controls->Add(this->label1);
            this->Controls->Add(this->button2);
            this->Controls->Add(this->button1);
            this->Controls->Add(this->menuStrip1);
            this->MainMenuStrip = this->menuStrip1;
            this->Name = L"Form1";
            this->Text = L"Form1";
            this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->EndInit();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->dg1))->EndInit();
            this->menuStrip1->ResumeLayout(false);
            this->menuStrip1->PerformLayout();
            this->ResumeLayout(false);
            this->PerformLayout();
 
        }
        float x1,y1,x2,y2; 
        double x,y,min,max,interval;
        array<float>^ a;                                    
        array<float>^ b;
        Bitmap^ bmp;
        Graphics^ gr;
    String^ FileName; 
  char* StrToChar(System::String^ string) 
{
  return (char*)(void*)Marshal::StringToHGlobalAnsi(string);
}
    
#pragma endregion
    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
                 dg1->Rows->Clear();
                
                 min=Convert::ToInt32(textBox1->Text);
                  max=Convert::ToInt32(textBox2->Text);
                  interval=Convert::ToInt32(textBox3->Text);
                 for(x=min;x<max;x=x+interval)
                 {
                    if (x==1)
                        x++;
                    if (x==-1)
                        x++;
                    
                    y=sin(x)*x;
                        
                    dg1->Rows->Add(x,y);
 
                 }
             }
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
             a = gcnew array<float>(dg1->RowCount);
             b = gcnew array<float>(dg1->RowCount);
 
            
            
             Pen^ p=gcnew Pen(pictureBox1->BackColor);
             SolidBrush^ sb=gcnew SolidBrush(pictureBox1->BackColor);
           gr->FillRectangle(sb,0,0,pictureBox1->Width,pictureBox1->Height);
 
            
                a[0]=Convert::ToDouble(dg1->Rows[0]->Cells[0]->Value)+pictureBox1->Width/2;
                b[0]=Convert::ToDouble(dg1->Rows[0]->Cells[1]->Value)+pictureBox1->Height/2;
 
 
             for(int i=0;i<dg1->RowCount-1;i++) 
             {
                x1=Convert::ToDouble(dg1->Rows[i]->Cells[0]->Value);
                y1=Convert::ToDouble(dg1->Rows[i]->Cells[1]->Value);
                x2=Convert::ToDouble(dg1->Rows[i+1]->Cells[0]->Value);
                y2=Convert::ToDouble(dg1->Rows[i+1]->Cells[1]->Value);
                x1=x1+pictureBox1->Width/2;
                y1=y1+pictureBox1->Height/2;
                x2=x2+pictureBox1->Width/2;
                y2=y2+pictureBox1->Height/2;
 
 
gr->DrawLine(Pens::Black,x1,y1,x2,y2);
a[i+1]=x2;
b[i+1]=y2;
            }
             pictureBox1->Image=bmp;
            
             Drawing::Font^ drawFont = gcnew Drawing::Font("Arial", 13);
            
             {
             gr->DrawString("X",drawFont,Brushes::Black,400,150);
            gr->DrawString("0",drawFont,Brushes::Black,204,135);
            gr->DrawString("0",drawFont,Brushes::Black,204,10);
             }
             
            
        gr->DrawLine (Pens::Black,0, pictureBox1->Height/2, pictureBox1->Width,pictureBox1->Height/2);
             gr->DrawLine (Pens::Black,pictureBox1->Width/2, 0, pictureBox1->Width/2,pictureBox1->Height);
                             for (int a=0;a<pictureBox1->Width;a+=5)
                    gr->DrawLine (Pens::Black,a, pictureBox1->Height/2-3,a,pictureBox1->Height/2+3);
 
             for (int a=0;a<pictureBox1->Height;a+=5)
        gr->DrawLine (Pens::Black, pictureBox1->Width/2-3,a,pictureBox1->Width/2+3,a);
             
 
 
              
 
         }
         
private: System::Void openFileDialog1_FileOk(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
              openFileDialog1->ShowDialog();
             Bitmap^ bmp=gcnew Bitmap(openFileDialog1->FileName);
             pictureBox1->Image=bmp;
         }
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
              bmp=gcnew Bitmap(pictureBox1->Width,pictureBox1->Height);
             gr=Graphics::FromImage(bmp);
         }
private: System::Void saveFileDialog1_FileOk(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
             if(saveFileDialog1->ShowDialog()==Windows::Forms::DialogResult::OK)
             {
                String^ FileName;
                FileName=saveFileDialog1->FileName;
                float xtab,ytab;
 
    
 
char * char_filename = (char *)((void*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(FileName));
FILE* f=fopen(char_filename,"wb");
System::Runtime::InteropServices::Marshal::FreeHGlobal(cli::safe_cast<System::IntPtr>(char_filename));
                for(int i=0;i<dg1->RowCount;i++)
                {
                    xtab=Convert::ToDouble(dg1->Rows[i]->Cells[0]->Value);
                    ytab=Convert::ToDouble(dg1->Rows[i]->Cells[1]->Value);
                    fwrite(&xtab,sizeof(float),1,f);
                    fwrite(&ytab,sizeof(float),1,f);
                }
                fclose(f);
             }
         }
private: System::Void saveToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
              if(saveFileDialog1->ShowDialog()==Windows::Forms::DialogResult::OK)
             {
                 bmp->Save(saveFileDialog1->FileName);
             }
         }
         
         
private: System::Void loadToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                   if (openFileDialog1->ShowDialog()== Windows::Forms::DialogResult::OK)
                  {
                        String^ FileName;
                FileName=openFileDialog1->FileName;
                      float xtab,ytab;
                FILE *f;
                
             f=fopen(StringToChar(FileName), "rb");
             while (feof(f))
             {
                 fread (&xtab,sizeof (float),1,f);
                 if (feof(f))
                 {
                    fread (&ytab,sizeof (float),1,f);
                    
                 }
             }}
         }
};
};
Code
1
Error   10  error C3861: 'StringToChar': identifier not found
вот такая вот ошибка в
392 строке
0
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
09.06.2011, 13:25
Ответы с готовыми решениями:

Как избавиться от ошибки 'CallNtPowerInformation': identifier not found
Здравствуйте, помогите опознать error C3861: 'CallNtPowerInformation': identifier not found...Как его подключить? библиотека powrpof...

error C3861: 'StringToChar': identifier not found
у меня ошибка уже нет сил исправлять... голова уже не варит... всю ночь исправлял.. =\\ вот код... ниже ошибка #pragma once ...

Identifier not found
Запись вроде бы объявил, но компилятор все равно пишет, что identifier not found &quot;prof&quot; и т.д. для всех полей записи. Помогите исправить...

0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
09.06.2011, 13:25
Помогаю со студенческими работами здесь

Identifier not found
Объясните пожалуйста почему компилятор выдаёт эту ошибку,и как лучше избегать таких моментов? #include &lt;iostream&gt; #include...

Error: Identifier not found
Помогите мне с работой в лазарусе. Так как изучать начала его сравнительно недавно, никак разобраться с ошибками(( procedure...

Злосчастный Identifier not found
Здравствуйте! у меня возникло следующая ошибка, которая очень сильно расстраивает в течении долгого времени - самому разобраться не...

C++ EnableEUDC identifier not found
Собсно, как исправить? вот код(соскрябал с инета): #include&lt;iostream&gt; #include&lt;windows.h&gt; void main(){ UINT codepage = GetACP();...

Ошибка identifier not found
Пытаюсь создать функцию по сортировке, ну и ее выполнение соответственно. Цель - разобраться с работой динамическими памятью и массивами. ...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
1
Ответ Создать тему
Опции темы

Новые блоги и статьи
Учёным и волонтёрам проекта «Einstein@home» удалось обнаружить четыре гамма-лучевых пульсара в джете Млечного Пути
Programma_Boinc 01.01.2026
Учёным и волонтёрам проекта «Einstein@home» удалось обнаружить четыре гамма-лучевых пульсара в джете Млечного Пути Сочетание глобально распределённой вычислительной мощности и инновационных. . .
Советы по крайней бережливости. Внимание, это ОЧЕНЬ длинный пост.
Programma_Boinc 28.12.2025
Советы по крайней бережливости. Внимание, это ОЧЕНЬ длинный пост. Налог на собак: https:/ / **********/ gallery/ V06K53e Финансовый отчет в Excel: https:/ / **********/ gallery/ bKBkQFf Пост отсюда. . .
Кто-нибудь знает, где можно бесплатно получить настольный компьютер или ноутбук? США.
Programma_Boinc 26.12.2025
Нашел на реддите интересную статью под названием Anyone know where to get a free Desktop or Laptop? Ниже её машинный перевод. После долгих разбирательств я наконец-то вернула себе. . .
Thinkpad X220 Tablet — это лучший бюджетный ноутбук для учёбы, точка.
Programma_Boinc 23.12.2025
Рецензия / Мнение/ Перевод Нашел на реддите интересную статью под названием The Thinkpad X220 Tablet is the best budget school laptop period . Ниже её машинный перевод. Thinkpad X220 Tablet —. . .
PhpStorm 2025.3: WSL Terminal всегда стартует в ~
and_y87 14.12.2025
PhpStorm 2025. 3: WSL Terminal всегда стартует в ~ (home), игнорируя директорию проекта Симптом: После обновления до PhpStorm 2025. 3 встроенный терминал WSL открывается в домашней директории. . .
Как объединить две одинаковые БД Access с разными данными
VikBal 11.12.2025
Помогите пожалуйста !! Как объединить 2 одинаковые БД Access с разными данными.
Новый ноутбук
volvo 07.12.2025
Всем привет. По скидке в "черную пятницу" взял себе новый ноутбук Lenovo ThinkBook 16 G7 на Амазоне: Ryzen 5 7533HS 64 Gb DDR5 1Tb NVMe 16" Full HD Display Win11 Pro
Музыка, написанная Искусственным Интеллектом
volvo 04.12.2025
Всем привет. Некоторое время назад меня заинтересовало, что уже умеет ИИ в плане написания музыки для песен, и, собственно, исполнения этих самых песен. Стихов у нас много, уже вышли 4 книги, еще 3. . .
От async/await к виртуальным потокам в Python
IndentationError 23.11.2025
Армин Ронахер поставил под сомнение async/ await. Создатель Flask заявляет: цветные функции - провал, виртуальные потоки - решение. Не threading-динозавры, а новое поколение лёгких потоков. Откат?. . .
Поиск "дружественных имён" СОМ портов
Argus19 22.11.2025
Поиск "дружественных имён" СОМ портов На странице: https:/ / norseev. ru/ 2018/ 01/ 04/ comportlist_windows/ нашёл схожую тему. Там приведён код на С++, который показывает только имена СОМ портов, типа,. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru