Dec 10, 2014 at 1:07am UTC
Hi guys,
I am having an issue with my Call Function to output data. The compiler doesn't like the Call function to output data. Any ideas?
#pragma once
namespace WindowsFormsApplication1 {
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::IO;
using namespace System::Runtime::InteropServices;
}
#pragma endregion
private: System::Void InputFileName_Click(System::Object^ sender, System::EventArgs^ e) {
// Clear Entries In The Text Boxes And Hide Message
InputFileName->Clear ( ) ;
OutputFileName->Clear ( ) ;
CompletedMessage->Visible = false;
}
private: System::Void ExitButton_Click(System::Object^ sender, System::EventArgs^ e) {
Application::Exit();
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void CreateFileButton_Click(System::Object^ sender, System::EventArgs^ e) {
Petdata *CurrentRecordPointer;
int InitIdNumber = 0;
char InitPetType[25] = "\0";
int InitPrice = 0;
ifstream DataFile;
ifstream FileOut;
char* InputFile;
InputFile = (char*)(void*)Marshal::StringToHGlobalAnsi(InputFileName->Text);
DataFile.open( InputFile );
if (!DataFile)
{
Application::Exit();
}
// * Get file name entered and store in "OutputFile" variable. *
char* OutputFile;
OutputFile = (char*)(void*)Marshal::StringToHGlobalAnsi(OutputFileName->Text);
FileOut.open( OutputFile );
if (!FileOut)
{
Application::Exit();
}
// **********************************
// * Read First Line Of Data *
// * Input Text File (Priming Read) *
// **********************************
DataFile >> InitIdNumber;
DataFile.get( InitPetType, 25 );
DataFile.ignore();
DataFile >> InitPrice;
while( DataFile)
{
// ****************************************
// * Call functions to create linked list *
// ****************************************
CurrentRecordPointer = new Petdata;
InsertItem( InitIdNumber, InitPetType, InitPrice,
CurrentRecordPointer );
HeadPointer = CurrentRecordPointer;
// ***********************************************
// * Read Next Line Of Data From Input Text File *
// ***********************************************
DataFile >> InitIdNumber;
DataFile.get( InitPetType, 25 );
DataFile.ignore();
DataFile >> InitPrice;
}
// ********************************
// * Call function to output data *
// ********************************
OutputItem( HeadPointer );
CompletedMessage->Visible = true;
// *****************************************
// * Delete/reset pointers and close files *
// *****************************************
DataFile.close();
FileOut.close();
delete CurrentRecordPointer;
HeadPointer = NULL;
}
// **********************************
// * Add an item to the linked list *
// **********************************
void InsertItem( int InitIdNumber, char InitPetType[], int InitPrice, Petdata *CurrentRecordPointer )
{
CurrentRecordPointer->IdNumber = InitIdNumber;
strcpy_s( CurrentRecordPointer->PetType, InitPetType );
CurrentRecordPointer->Price = InitPrice;
CurrentRecordPointer->Link = HeadPointer;
return;
}
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void textBox2_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {
}
};
};
Dec 10, 2014 at 1:33am UTC
This is so disgusting that it doesn't even look like c++.
Like I have never seen the ^
bitwise xor operator used in an argument like that before...
You didn't format your code...
I don't see any #includes...
And you put in so little effort in describing the problem while not even giving us compilable code...