Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++]Questions about input and output with files

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
M.CORP
Grandmaster Cheater Supreme
Reputation: 28

Joined: 28 Oct 2009
Posts: 1010

PostPosted: Mon Sep 12, 2011 2:57 am    Post subject: [C++]Questions about input and output with files Reply with quote

CPP file:
Code:
#include "stdafx.h"
using namespace std;

int main () {
   string fileE;
   ofstream myfile ("example.txt");
   ifstream myfile1 ("example.txt");

   if (myfile.is_open()){
      myfile << "Hello there USER! :P\n";
      myfile.close();
      getline (myfile1, fileE);
      cout << fileE << endl;
   }
   else {
      cout << "Unable to open D:!\nCreating a new one!\n";
      myfile << "asfasdf!";
   }
   cin.get();
   return 0;
}


Header file:
Code:
#pragma once

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

In this example, can i declare fstream only by itself without declaring iostream to achieve the same result as the above without using of/ifstreams?

_________________
Shameless Self Advertising Very Happy!
Steam
Just lurking around...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites