This message is long, just focas on the bold parts which their aint that much, dont mind the smilies
Plz help me solve the compile error

An overview of my program
The program takes the results from a html form(questionaire) than either updates the files with the results or adds the results(which would be the first time the program was used when the first form was submited) The files that the program outputs to are html, so the results had to be put in a specific position,(via the function getposition), in the file in order for a browser to show the questions, the answers, the amount of answers per anwser.
ex: how old are you?
18 (3 said 18)
19 (100 said 19)
20 (9999 said 20)

[B]header file[/B]
#ifndef STAT_H
#define STAT_H

#include <string>
using std::string;
#include <fstream>

class stats {
public:
	stats(string = "",string ="", string ="");
	int getAge(string);
	int getSexe(string);
	int setSexe(int);
	int setQuery(string);
	int getStats(string);
	int getPosition(string);
	int checkIfStatExist();
	int control(int);
	[B]int dataProcess(fstream,fstream,fstream,int,int,int);[/B]
private:
	int age;
	int sexe;
	int stat;
	int exist;
	int position;
	string query;
};
#endif


//here is one of the html files that the program will use
	[I]fstream globale("globale.html", ios::in | ios::out );[/I]

*********************************************************
stats::control(int decision)
{
	[B]dataProcess(globale,globaleM,globaleF,decision,position,stat);[/B]
	switch(age)
	{
//in each case the function dataProcess is errored by [U][I]cannot convert parameter 1 from 'std::fstream' to 'std::fstream'[/I][/U] Note: that error is the only compile error which happens in five instances so five errors
		case 14: [B]dataProcess(fourteen,fourteenM,fourteenF,decision,position,stat);[/B]			break;
		case 15: [B]dataProcess(fifteen,fifteenM,fifteenF,decision,position,stat);[/B]			break;
		case 16: [B]dataProcess(sixteen,sixteenM,sixteenF,decision,position,stat);[/B]			break;
		case 17: [B]dataProcess(seventeen,seventeenM,seventeenF,decision,position,stat);[/B]			break;
	}
	return 0;
}****************************************************
stats::dataProcess(fstream data,fstream dataM,fstream dataF, int dec, int pos, int sta)
{
	char *dataPtr = 0;
	string dataMStr;
	string dataFStr;
	data.seekg(pos);
	dataM.seekg(pos);
	dataF.seekg(pos);
	if (dec = 0)//write
	{
    data << stat;
	dataM << stat;
	dataF << stat;
	}
	else //update
	{
		data.read(dataPtr,10);
		string dataStr = dataPtr;
		dataStr.c_str();
		const char *globalStrPtr = dataStr.data();
		int data = atoi(globalStrPtr);
		int finalStat = data + stat;
	}

	return 0;
}

Recommended Answers

All 2 Replies

Hi,

I have the same problem. Can you tell me how you solved this one?

Thanks.

You probably want to pass by reference.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.