Click here to Skip to main content
15,899,126 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Displaying image on full screen Pin
ThatsAlok29-Nov-05 17:59
ThatsAlok29-Nov-05 17:59 
GeneralRe: Displaying image on full screen Pin
Vancouver29-Nov-05 20:15
Vancouver29-Nov-05 20:15 
Questionvisual basic and access Pin
RiNaZaiNoN23-Nov-05 15:24
RiNaZaiNoN23-Nov-05 15:24 
QuestionSort Array of Objects Pin
kenexcelon23-Nov-05 14:23
kenexcelon23-Nov-05 14:23 
AnswerRe: Sort Array of Objects Pin
Christian Graus23-Nov-05 14:37
protectorChristian Graus23-Nov-05 14:37 
QuestionEdit Control flashes Pin
LeeeNN23-Nov-05 13:51
LeeeNN23-Nov-05 13:51 
QuestionEmbedded browser control leaks handles? Pin
dandy7223-Nov-05 11:25
dandy7223-Nov-05 11:25 
Questionfile searching problem Pin
Binary011023-Nov-05 8:40
Binary011023-Nov-05 8:40 
I'm trying to search an input file for all occurences of a user specified string and return how many times the word was found and read that into an output file. For some reason the the value of the string changes to every word in the text file at runtime. What am I doing wrong?

#include <iostream><br />
#include <string><br />
#include <ciso646><br />
#include <fstream><br />
using namespace std;<br />
<br />
int main(void)<br />
{<br />
	<br />
	<br />
	string filename;<br />
	cout << "Please enter the name of the file: " ;<br />
	cin >> filename;<br />
	string search;<br />
	cout << "Please enter the word to search for";<br />
	cin >> search;<br />
	<br />
	ifstream fin(filename.c_str());<br />
	while (fin.fail())<br />
	{<br />
		cout << "invalid file name"<< endl;<br />
		cout << endl << "Please enter the name of the file: ";<br />
		cin >> filename;<br />
<br />
		fin.clear();<br />
		fin.open( filename.c_str() );<br />
<br />
	}<br />
	<br />
	int count=0;<br />
	<br />
	while (fin >> (search))<br />
	{<br />
		<br />
		count++;<br />
	<br />
	}<br />
<br />
	ofstream fout("output.txt");<br />
	fout << "The number of times "<< search <<" was found is "<< count << endl;<br />
	<br />
<br />
<br />
<br />
<br />
<br />
<br />
system ("pause");<br />
return 0;<br />
}


BINARY
AnswerRe: file searching problem Pin
Curtis Schlak.23-Nov-05 9:57
Curtis Schlak.23-Nov-05 9:57 
QuestionDefining a target architecture Pin
Demian Panello23-Nov-05 8:20
Demian Panello23-Nov-05 8:20 
QuestionRegistration or Login Screen in an SDI application Pin
sdancer7523-Nov-05 7:22
sdancer7523-Nov-05 7:22 
AnswerRe: Registration or Login Screen in an SDI application Pin
Marc Soleda23-Nov-05 20:47
Marc Soleda23-Nov-05 20:47 
AnswerRe: Registration or Login Screen in an SDI application Pin
Cool Ju24-Nov-05 0:37
Cool Ju24-Nov-05 0:37 
QuestionMFC and Global Variables :How can i access them ? Pin
sdancer7523-Nov-05 7:19
sdancer7523-Nov-05 7:19 
AnswerRe: MFC and Global Variables :How can i access them ? Pin
BlackDice23-Nov-05 11:08
BlackDice23-Nov-05 11:08 
AnswerRe: MFC and Global Variables :How can i access them ? Pin
Christian Graus23-Nov-05 11:28
protectorChristian Graus23-Nov-05 11:28 
AnswerRe: MFC and Global Variables :How can i access them ? Pin
ThatsAlok28-Nov-05 17:39
ThatsAlok28-Nov-05 17:39 
QuestionHow to set LPT ? to read and write byte Pin
quangpk23-Nov-05 5:33
quangpk23-Nov-05 5:33 
AnswerRe: How to set LPT ? to read and write byte Pin
khan++23-Nov-05 23:08
khan++23-Nov-05 23:08 
GeneralRe: How to set LPT ? to read and write byte Pin
quangpk1-Dec-05 6:35
quangpk1-Dec-05 6:35 
QuestionHow to read and write data to File's section Pin
Loc Milkyway23-Nov-05 4:51
Loc Milkyway23-Nov-05 4:51 
AnswerRe: How to read and write data to File's section Pin
ThatsAlok28-Nov-05 17:06
ThatsAlok28-Nov-05 17:06 
GeneralRe: How to read and write data to File's section Pin
Loc Milkyway29-Nov-05 2:42
Loc Milkyway29-Nov-05 2:42 
GeneralRe: How to read and write data to File's section Pin
ThatsAlok29-Nov-05 17:41
ThatsAlok29-Nov-05 17:41 
GeneralRe: Thank you Pin
Loc Milkyway30-Nov-05 3:25
Loc Milkyway30-Nov-05 3:25 

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.