Original Post
Hi Guys,
I am writing a simple program at the moment to take input from a file and put it in an array. At the moment the code looks like this.
Which works, but is not very neat, plus the code to enter a string that is larger than 10 chars long would start to be a problem, I could not get, get or getline to work correctly, is there another way? should I be able to use get and getline to input into a array of char in a class ?
Another problem I will be coming to soon is getting my program to kick off a .exe file on another computer, is there a way of doing that without writing a client for the other machine ? maybe a RFC ?
Please try not to send full source code, I would just like a nudge in a general direction.
Thanks,
MK83
int fImport()
{
char Box[4];
SendMessage(hEBox,WM_GETTEXT,(WPARAM)4,(LPARAM)Box);
iAmmTrans = 0;
ifstream Importfile("Import.txt");
ofstream Outputfile("Output.txt");
char BUFFER[50];
while (Importfile.getline(BUFFER,50,''\n''))
{
aTransports[++iAmmTrans].sTransType[0] = BUFFER[0];
aTransports[iAmmTrans].sTransType[1] = BUFFER[1];
aTransports[iAmmTrans].sTransType[2] = BUFFER[2];
aTransports[iAmmTrans].sTransType[3] = BUFFER[3];
aTransports[iAmmTrans].sTransType[4] = ''\0'';
aTransports[iAmmTrans].sTransNum[0] = BUFFER[4];
aTransports[iAmmTrans].sTransNum[1] = BUFFER[5];
aTransports[iAmmTrans].sTransNum[2] = BUFFER[6];
aTransports[iAmmTrans].sTransNum[3] = BUFFER[7];
aTransports[iAmmTrans].sTransNum[4] = BUFFER[8];
aTransports[iAmmTrans].sTransNum[5] = BUFFER[9];
aTransports[iAmmTrans].sTransNum[6] = ''\0'';
aTransports[iAmmTrans].sBox[0] = Box[0];
aTransports[iAmmTrans].sBox[1] = Box[1];
aTransports[iAmmTrans].sBox[2] = Box[2];
aTransports[iAmmTrans].sBox[3] = ''\0'';
Outputfile << aTransports[iAmmTrans].sTransNum <<
aTransports[iAmmTrans].sTransType << aTransports
[iAmmTrans].sBox << endl;
};
return 0;
};
|