Click here to Skip to main content
15,885,546 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: SetFocus Function Pin
Chris Losinger20-Jan-10 17:39
professionalChris Losinger20-Jan-10 17:39 
AnswerRe: SetFocus Function Pin
LunaticFringe20-Jan-10 17:40
LunaticFringe20-Jan-10 17:40 
AnswerRe: SetFocus Function Pin
vasu_sri20-Jan-10 21:23
vasu_sri20-Jan-10 21:23 
AnswerRe: SetFocus Function Pin
Stephen Hewitt21-Jan-10 1:02
Stephen Hewitt21-Jan-10 1:02 
QuestionC++ fstream's write operation is Sync or aSync? Pin
iceman861620-Jan-10 16:46
iceman861620-Jan-10 16:46 
AnswerRe: C++ fstream's write operation is Sync or aSync? Pin
Chris Losinger20-Jan-10 17:00
professionalChris Losinger20-Jan-10 17:00 
GeneralRe: C++ fstream's write operation is Sync or aSync? Pin
iceman861621-Jan-10 13:20
iceman861621-Jan-10 13:20 
QuestionReading files... Pin
Jacob Dixon20-Jan-10 16:25
Jacob Dixon20-Jan-10 16:25 
I currently program in C# and decided to make a move to C++. I am finding it a little more difficult than I thought. I mean I am having trouble even reading a file. I am using XCode on Mac OS X Snow:

#include <cstdio>
#include <fstream>
#include <istream>
#include <ostream>
#include <iostream>

int main () {
	using namespace std;
	
	ifstream in("/Users/Dixon/MyFile.rtf");
	if (not in)
		perror("/Users/Dixon/MyFile.rtf");
	else {
		int x(0);
		while (in >> x)
		{
			cout << x << '\n';
		}
		cout << "Ending....";
		in.close();
	}
}


Output:
[Switching to process 16406]
Running…
Ending....
Debugger stopped.
Program exited with status value:0.


Ok, now I understand I am not getting any errors when opening this file. The problem is it isn't reading anything from it. I have put 5 lines in there (just one word on each line). Now according to my book (Exploring C++ by Apress), this hsould work. This code is pretty much exactly from their book. Except in their book they used a list1302.in file as I used a RTF file. Maybe that is the problem? I really don't know what an IN file is exactly (coming from Windows world)
AnswerRe: Reading files... Pin
Jacob Dixon20-Jan-10 16:37
Jacob Dixon20-Jan-10 16:37 
AnswerRe: Reading files... Pin
Avi Berger20-Jan-10 16:48
Avi Berger20-Jan-10 16:48 
GeneralRe: Reading files... Pin
Jacob Dixon20-Jan-10 16:54
Jacob Dixon20-Jan-10 16:54 
GeneralRe: Reading files... Pin
Jacob Dixon20-Jan-10 17:00
Jacob Dixon20-Jan-10 17:00 
GeneralRe: Reading files... Pin
Jacob Dixon20-Jan-10 17:02
Jacob Dixon20-Jan-10 17:02 
GeneralRe: Reading files... Pin
Avi Berger20-Jan-10 17:16
Avi Berger20-Jan-10 17:16 
GeneralRe: Reading files... Pin
Jacob Dixon20-Jan-10 17:17
Jacob Dixon20-Jan-10 17:17 
GeneralOT [modified] Pin
Avi Berger20-Jan-10 18:15
Avi Berger20-Jan-10 18:15 
QuestionRe: Reading files... Pin
David Crow20-Jan-10 17:03
David Crow20-Jan-10 17:03 
AnswerRe: Reading files... Pin
Jacob Dixon20-Jan-10 17:11
Jacob Dixon20-Jan-10 17:11 
QuestionSpin control: how does it works, specially when it changes acceleration ? Pin
timbk20-Jan-10 13:40
timbk20-Jan-10 13:40 
Questionconcat two char * variables Pin
santhosh-padamatinti20-Jan-10 6:13
santhosh-padamatinti20-Jan-10 6:13 
AnswerRe: concat two char * variables Pin
Rajesh R Subramanian20-Jan-10 6:26
professionalRajesh R Subramanian20-Jan-10 6:26 
GeneralRe: concat two char * variables Pin
santhosh-padamatinti20-Jan-10 6:33
santhosh-padamatinti20-Jan-10 6:33 
GeneralRe: concat two char * variables Pin
Fatbuddha 120-Jan-10 6:46
Fatbuddha 120-Jan-10 6:46 
QuestionRe: concat two char * variables Pin
CPallini20-Jan-10 10:47
mveCPallini20-Jan-10 10:47 
AnswerRe: concat two char * variables Pin
Luc Pattyn20-Jan-10 11:18
sitebuilderLuc Pattyn20-Jan-10 11:18 

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.