Click here to Skip to main content
15,921,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to run an application only in particular system? Pin
jhwurmbach15-Feb-07 4:01
jhwurmbach15-Feb-07 4:01 
AnswerRe: How to run an application only in particular system? Pin
Hamid_RT15-Feb-07 4:24
Hamid_RT15-Feb-07 4:24 
GeneralRe: How to run an application only in particular system? Pin
Super Hornet15-Feb-07 4:43
Super Hornet15-Feb-07 4:43 
GeneralRe: How to run an application only in particular system? Pin
Hamid_RT15-Feb-07 7:25
Hamid_RT15-Feb-07 7:25 
AnswerRe: How to run an application only in particular system? Pin
malaugh15-Feb-07 9:07
malaugh15-Feb-07 9:07 
GeneralRe: How to run an application only in particular system? Pin
Super Hornet16-Feb-07 5:06
Super Hornet16-Feb-07 5:06 
AnswerRe: How to run an application only in particular system? Pin
Gary R. Wheeler17-Feb-07 4:39
Gary R. Wheeler17-Feb-07 4:39 
Questionopening a file for output Pin
klutez12315-Feb-07 3:22
klutez12315-Feb-07 3:22 
i have to open ADDRESS.DAT i used in a previous assignment, i put the file in the same project folder as this assignment but i keep getting an error.
The assignment is to open the ADDRESS.DAT file and output it to the screen:

the error: c:\documents and settings\lutyk7\desktop\projects\project 8-3\project 8-3\project 8-3.cpp(75) : error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::basic_ostream<_Elem,_Traits>' (or there is no acceptable conversion)

the code:

#include "stdafx.h"<br />
#include <iostream><br />
#include <iomanip><br />
#include <fstream><br />
#include <string><br />
<br />
<br />
<br />
<br />
// The one and only application object<br />
<br />
CWinApp theApp;<br />
<br />
using namespace std;<br />
<br />
/******************************************<br />
*                M  A  I  N               *<br />
******************************************/<br />
<br />
int main()<br />
{<br />
	string name, address, city, state, x; <br />
	ofstream outfile;     //Declare file stream name outfile.<br />
	ifstream infile;<br />
	<br />
	cout<<"Please enter your name: ";<br />
	getline(cin, name);<br />
	cout<<"Please enter your address: ";<br />
	getline(cin, address);<br />
	cout<<"Please enter with city: ";<br />
	getline(cin, city);<br />
	cout<<"Please enter your state: ";<br />
	getline(cin, state);<br />
	cout<<"Enter your zipcode: ";<br />
	cin>>x;<br />
<br />
	outfile.open("ADDRESS.DAT",ios::app);   //Open file for output.<br />
	<br />
	if(outfile)<br />
	{<br />
		outfile<<name<<endl;<br />
		outfile<<address<<endl;<br />
		outfile<<city<<", "<<state<<" "<<x<<'\n'<<endl;<br />
		outfile.close();   //Close the output file.<br />
	}<br />
	else<br />
	{<br />
		cout <<"An error occurred while opening the file.\n";<br />
	}<br />
	<br />
	infile.open("ADDRESS.DAT",ios::in);<br />
<br />
	if (infile)<br />
	{<br />
		cout.setf(ios::fixed);<br />
		cout << "The information your entered is as follows:\n"<br />
			<< setprecision(1);<br />
			 <br />
		cout << name >> endl;<br />
		cout << address >> endl;<br />
		cout << city >> ", " >> state >> " " >> x >> endl;<br />
		cout << name << endl;<br />
		cout << address << endl;<br />
		cout << city << ", " << state << " " <<x<<endl;<br />
	}<br />
	else<br />
	{<br />
		cout << "An error occurred while opening the file.\n";<br />
	}<br />
	infile.close();<br />
	return 0;<br />
}

AnswerRe: opening a file for output Pin
toxcct15-Feb-07 3:26
toxcct15-Feb-07 3:26 
AnswerRe: opening a file for output Pin
benjymous15-Feb-07 4:37
benjymous15-Feb-07 4:37 
QuestionHow to disable USB Port/Drive permanently? Pin
Super Hornet15-Feb-07 3:10
Super Hornet15-Feb-07 3:10 
AnswerRe: How to disable USB Port/Drive permanently? Pin
Michael Dunn15-Feb-07 20:54
sitebuilderMichael Dunn15-Feb-07 20:54 
AnswerRe: How to disable USB Port/Drive permanently? Pin
Newbie0016-Feb-07 3:20
Newbie0016-Feb-07 3:20 
QuestionRe: How to disable USB Port/Drive permanently? Pin
Super Hornet16-Feb-07 4:45
Super Hornet16-Feb-07 4:45 
AnswerRe: How to disable USB Port/Drive permanently? Pin
Newbie0016-Feb-07 5:23
Newbie0016-Feb-07 5:23 
AnswerRe: How to disable USB Port/Drive permanently? Pin
Hamid_RT15-Feb-07 3:17
Hamid_RT15-Feb-07 3:17 
GeneralRe: How to disable USB Port/Drive permanently? Pin
Super Hornet15-Feb-07 3:23
Super Hornet15-Feb-07 3:23 
QuestionFormatting of LVI item Pin
ldsdbomber15-Feb-07 2:58
ldsdbomber15-Feb-07 2:58 
AnswerRe: Formatting of LVI item Pin
David Crow15-Feb-07 3:04
David Crow15-Feb-07 3:04 
GeneralRe: Formatting of LVI item Pin
ldsdbomber15-Feb-07 3:44
ldsdbomber15-Feb-07 3:44 
QuestionVC++ Pin
Member 335661715-Feb-07 2:57
Member 335661715-Feb-07 2:57 
AnswerRe: VC++ Pin
toxcct15-Feb-07 2:58
toxcct15-Feb-07 2:58 
QuestionRe: VC++ Pin
David Crow15-Feb-07 3:03
David Crow15-Feb-07 3:03 
QuestionRe: VC++ Pin
prasad_som15-Feb-07 3:10
prasad_som15-Feb-07 3:10 
AnswerRe: VC++ [Modified] Pin
toxcct15-Feb-07 3:10
toxcct15-Feb-07 3:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.