|
Answer» Hey guys,
I cant seem to figure out how to make a single input file be read and output into ANOTHER file when its in an array for example
ID Type Name Stock Price 21 Phone Nokia 10 $500 22 Laptop IBM 10 $2000 etc etc etc etc etc
when i try to read this from the input file it will only outputs the 21 in the first line and everything after the space is left out, i TRIED doing this a different way but i thought it was a really dumb way to fix the issue, this is what ive done:
string itemID; string itemType; string itemName; string itemStock; string itemPrice;
ifstream ID; ifstream Type; ifstream Name; ifstream Stock; ifstream Price;
ofstream outData;
ID.open("ID.txt"); Type.open("Type.txt"); Name.open("Name.txt"); Stock.open("Stock.txt"); Price.open("Price.txt"); outData.open("outData.out", ios::app);
ID >> itemID; Type >> itemType; Name >> itemName; Stock >> itemStock; Price >> itemPrice;
outData << "\t\t\t::Inventory:: \n\n\n" << itemID << endl << itemType << endl << itemName << endl << itemStock << endl << itemPrice << endl;
along with me having to make a bunch of unneccessary files i also have to seperate my data, also my files output horizontally not vertically, so basically i need to know how to input an array, although it if was that basic i would know how to do it :s
any HELP will be great
Khasiardw guyz i figured it out, in case you WANTED to know
ID >> itemID >> itemType >> itemName >> itemStock >> itemPrice;
outData << itemID << " " << itemType << " " << itemName << " " << itemStock << " " << itemPrice << endl;
is the way to get the space INCLUDED from input
|