Hello everyone.
I'm having quite a rough time with my program because my code isnt just working

#include <string>
#include <iostream>
#include <string>
#include <stdlib.h>
#include <windows.h>
using namespace std;
#include "DBase.h"
#include "Client.h"
list <Client> l;
DBase *example;
int main (void)
{

  string user= "my username";
  string pass = "my pass";
  string db = "my database ip"; 
try {
    cout << "Connecting..." << endl;
    example = new DBase (user, pass, db);
  
	cout<<"Connectiong Successful!"<<endl;

l = example->readClients();
cout << setw(5) << "COD" << " | "  
<< setw(12) << "NAME" << "         | "
<< setw(6) << "NUMBER ID" << "    | "
<< setw(14) << "ADRESS" << "       | " << endl;
for (list<Client>::iterator it = l.begin(); it != l.end(); it++)
cout << *it;
cout << endl;
   
    cout << "Closing" << endl;
  }
catch (SQLException error) {
    cerr << "Error: " << error.getMessage () << endl;
  }
cin.get();
return 0;
}

I keep getting this error:

Unhandled exception at 0x5e217a8b (msvcp90d.dll) in Teste.exe: 0xC0000005: Access violation reading location 0xcccccccc.

If someone could help me out I'd be really grateful.
Thank you in advanced.

Recommended Answers

All 3 Replies

Access violation reading location 0xcccccccc.

Look for an uninitialized local variable in your debugger.

All my local variable are initialized though..

All my local variable are initialized though..

Then you must be imagining the error. :icon_rolleyes:

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.