Ok here is what I want... I want to read the Dictionary file, and output its contents into the dynamic-text.dat file... But it reads the dictionary file and it will not write to the dynamic-text.dat file and I have no clue why... what am i doing wrong.. when I split the code, both files can be opened and written to, but when its like this, they will not read from one and write its contents to the other! =( Also If I altered the program to allow the user to input a string of words into the file, it will only input the first word.. anyone got any ideas?
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
using namespace std;
int main () {
string line;
ifstream Dict ("C:/Users/Brandon/Desktop/Programs C++/Dictionary.txt");
if (Dict.is_open())
{
getline (Dict,line);
Sleep(1000);
ifstream file ("C:/Users/Brandon/Desktop/test.txt", ios::out | ios::app | ios::binary);
if (file.is_open())
{
cout<< line <<" ";
}
else cout <<"Cannot Open 'File' for writing";
file.close();
Dict.close();
}
else cout << "Unable to open 'Dict' for reading";
Sleep(5000);
return 0;
}