Click here to Skip to main content
15,891,513 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: PlaySound Pin
Ali Rafiee18-Jul-06 9:43
Ali Rafiee18-Jul-06 9:43 
AnswerRe: PlaySound Pin
Hamid_RT18-Jul-06 18:55
Hamid_RT18-Jul-06 18:55 
QuestionIntercepting mouse clicks or keystrokes Pin
Igor Vigdorchik18-Jul-06 9:20
Igor Vigdorchik18-Jul-06 9:20 
AnswerRe: Intercepting mouse clicks or keystrokes Pin
Blake Miller20-Jul-06 7:12
Blake Miller20-Jul-06 7:12 
GeneralRe: Intercepting mouse clicks or keystrokes Pin
Igor Vigdorchik20-Jul-06 7:27
Igor Vigdorchik20-Jul-06 7:27 
Questionmany projects -> solution Pin
jimNLX18-Jul-06 8:45
jimNLX18-Jul-06 8:45 
AnswerRe: many projects -> solution Pin
Ali Rafiee18-Jul-06 9:16
Ali Rafiee18-Jul-06 9:16 
Questioniostream/fstream problem [modified] Pin
CoffeeAddict1918-Jul-06 8:41
CoffeeAddict1918-Jul-06 8:41 
I'm trying to load a disk file into memory and the program crashes when it tries to exit. As far as I can tell the file never got loaded. The compiler dosen't catch the error, but the debugger did point to this part of ios.cpp when it crashed, the line has a smilie next to it:

<br />
ios_base::~ios_base()<br />
	{	// destroy the object<br />
	if (0 < _Stdstr && 0 < --stdopens[_Stdstr]):mad:<br />
		return;<br />
	_Tidy();<br />
	_DELETE_CRT(_Ploc);<br />
	}


My specification file code:

#include "DnD_Common_Defs.h"<br />
#include "windows.h"<br />
#include <iostream><br />
#include <string><br />
#include <fstream><br />
<br />
using namespace std;<br />
<br />
class DataLoading<br />
{<br />
public:<br />
	DataLoading(); //default constructor <br />
	RaceDataType ReturnRaceData(int RaceToReturn);<br />
protected:<br />
	bool LoadUpRaceData(string FileName); //loads race data from file<br />
private:<br />
	int NumBaseRaces;<br />
	ifstream inData; //input file stream<br />
	RaceDataType BaseRaces[6];	<br />
};


Relevant parts of implementation file code:

#include <iostream><br />
#include <fstream><br />
#include <string><br />
#include <cctype><br />
#include "Data_Loading_Class.h"<br />
#include "DnD_Common_Defs.h"<br />
<br />
using namespace std;<br />
<br />
DataLoading::DataLoading()<br />
{<br />
	bool LoadedSuccessfully = false;<br />
	const string RaceDataFileName = "RaceData.dat";<br />
	NumBaseRaces = 7; <br />
<br />
	LoadedSuccessfully = LoadUpRaceData(RaceDataFileName);<br />
}<br />
bool DataLoading::LoadUpRaceData(string FileName)<br />
{<br />
	bool NoError = true;<br />
	inData.open(FileName.c_str()); //open up file stream<br />
<br />
	for(int i=-1; i<(NumBaseRaces-1); i++)<br />
	{<br />
		inData.ignore(30, ':');<br />
		inData>>BaseRaces[i].RaceName;<br />
		inData.ignore(30, ':');<br />
		inData>>BaseRaces[i].ScoreAdjustments.STRadj;<br />
		inData.ignore(30, ':');<br />
		inData>>BaseRaces[i].ScoreAdjustments.DEXadj;<br />
		inData.ignore(30, ':');<br />
		inData>>BaseRaces[i].ScoreAdjustments.CONadj;<br />
		inData.ignore(30, ':');<br />
		inData>>BaseRaces[i].ScoreAdjustments.INTadj;<br />
		inData.ignore(30, ':');<br />
		inData>>BaseRaces[i].ScoreAdjustments.WISadj;<br />
		inData.ignore(30, ':');<br />
		inData>>BaseRaces[i].ScoreAdjustments.CHAadj;<br />
	}<br />
	if(inData)<br />
		NoError = true;<br />
	else<br />
		NoError = false;<br />
	inData.close(); //close file stream<br />
	<br />
	return NoError;<br />
}


Thanks in advance. Smile | :)

-- modified at 14:48 Tuesday 18th July, 2006
AnswerRe: iostream/fstream problem Pin
earl18-Jul-06 12:02
earl18-Jul-06 12:02 
QuestionWindows File Access Monotoring Pin
sundar15618-Jul-06 8:35
sundar15618-Jul-06 8:35 
AnswerRe: Windows File Access Monotoring Pin
Chris Losinger18-Jul-06 11:24
professionalChris Losinger18-Jul-06 11:24 
AnswerRe: Windows File Access Monotoring Pin
Kharfax19-Jul-06 2:25
Kharfax19-Jul-06 2:25 
GeneralRe: Windows File Access Monotoring Pin
sundar1562-Aug-06 11:01
sundar1562-Aug-06 11:01 
Questionhook [modified] Pin
farshad.f18-Jul-06 7:47
farshad.f18-Jul-06 7:47 
AnswerRe: hook Pin
David Crow18-Jul-06 8:30
David Crow18-Jul-06 8:30 
GeneralRe: hook Pin
farshad.f18-Jul-06 19:51
farshad.f18-Jul-06 19:51 
AnswerRe: hook Pin
Ali Rafiee18-Jul-06 9:28
Ali Rafiee18-Jul-06 9:28 
GeneralRe: hook Pin
farshad.f18-Jul-06 19:55
farshad.f18-Jul-06 19:55 
QuestionDesk Band Pin
neoandrew18-Jul-06 7:45
neoandrew18-Jul-06 7:45 
QuestionListing running Apps Pin
Kharfax18-Jul-06 7:23
Kharfax18-Jul-06 7:23 
AnswerRe: Listing running Apps Pin
Ravi Bhavnani18-Jul-06 7:30
professionalRavi Bhavnani18-Jul-06 7:30 
GeneralRe: Listing running Apps Pin
Kharfax18-Jul-06 7:37
Kharfax18-Jul-06 7:37 
AnswerRe: Listing running Apps Pin
Ali Rafiee18-Jul-06 7:43
Ali Rafiee18-Jul-06 7:43 
GeneralRe: Listing running Apps Pin
Kharfax18-Jul-06 7:48
Kharfax18-Jul-06 7:48 
GeneralRe: Listing running Apps Pin
ThatsAlok19-Jul-06 6:17
ThatsAlok19-Jul-06 6:17 

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.