Hi, some of you might remember me from a database project I was working on ages ago, or, you might not .
Anyways, I've recently picked up my C++ projects again, and set about redoing the code for the Database program.
All was going well until I got weird errors that I didn't seem to be able to solve, and I was hoping someone on this board could help me.
Alright, here's the code:
Code:
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <clrscr.h> // Yesyes, a custom header thingy, but no credit 2 me, it's taken from the faq.
using namespace std;
/*
30-12-05 20:38
Thanks people of the cboard forum!!!
Special thanks:
xhi
xhi
xhi
xhi
*Repeat above 200000 times*
Me
*/
struct Database {
int id;
string name;
int age;
};
int main() {
Database emp;
int choice;
string name = "database/Member";
string dat = ".dat";
string sid;
...
...
} //Bad code starts below I think
if (choice == 1){
int id = 0;
ifstream fin;
stringstream s;
fin.open("database/Member1.dat");
for(!fin.bad()) {
string filename = " ";
id = id + 1;
s << id;
s >> sid;
filename = name + sid + txt;
fin.open(filename.c_str(), ios::binary);
fin.read((char *)(&emp), sizeof(emp));
cout << "Id: " << emp.id << endl << "Name: " << emp.name << endl << "Age: " << emp.age << "\n\n";
cin.get();
fin.close();
ifstream fin;
}
}
}
And these are the errors I get:
- 67 C:\Documents and Settings\Tim\Mijn documenten\My C++\FinFoutDbase.cpp expected `;' before ')' token
- 80 C:\Documents and Settings\Tim\Mijn documenten\My C++\FinFoutDbase.cpp expected primary-expression before '}' token
- 80 C:\Documents and Settings\Tim\Mijn documenten\My C++\FinFoutDbase.cpp expected `;' before '}' token
- 80 C:\Documents and Settings\Tim\Mijn documenten\My C++\FinFoutDbase.cpp expected primary-expression before '}' token
I get more then those, but basically they are all the same.
The compiler/editor I use is:
Bloodshed Dev C++ version 4.9.9.2
I have absolutely no idea as to where these erorrs are coming from, or how to solve them. Any ideas are welcome.