Here is the code:
CDatabase m_db;
m_db.OpenEx(_T( "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=mydb;UID=root;PASSWORD=123123;OPTION=3;"), FALSE );
CRecordset recSet(&m_db);
recSet.Open(AFX_DB_USE_DEFAULT_TYPE, _T("SELECT * From articles"), CRecordset::executeDirect);
int nRecords = recSet.GetRecordCount(); // Equals to 1!
...
Consider developing an application where the model will be written in C++ (with Boost), and the view will be written in Objective-C++ (with Cocoa Touch).
Where are some examples showing how to integrate C++ and Objective-C++ for developing iPhone applications?
...
What could be cause of QAbstractSocket::UnknownSocketError when using QTcpSocket?
CODE
I'm getting this error code with the following code:
this->connect(socket, SIGNAL(socketError(QAbstractSocket::SocketError)), SLOT(handleSocketError(QAbstractSocket::SocketError)));
...
void MyClass::handleSocketError(QAbstractSocket::SocketError ...
There is a client (user) who wants to interact with Process B. For security purposes, Process A is between client and Process B. Users can only access Process A. Process A is a relay. It reads from the client (user) and sends data without modification to Process B. It also reads from Process B and sends data to the user without modificat...
Hey guys, this is very likely a total brain fart on my part but I was hoping someone could have a look at the following statement which describes how to set up the lagged fibonacci rng:
First, generate four million pseudo-random numbers using a specific form of what is known as a "Lagged Fibonacci Generator":
For 1 ≤ k ≤ 55, s(k...
I'm wondering whether the C++ string is considered small enough to be more efficient when passed by value than by reference.
...
What is difference between "new operator" and "operator new"?
Thanks.
...
NOTE: THIS IS FOR HOMEWORK SO PLEASE DO NOT INCLUDE BLOCKS OF CODE IN YOUR ANSWERS
I have an assignment that requires us to implement a doubly linked list class. For some reason they defined the node struct as follows:
struct node {
node *next;
node *prev;
T *o;
};
It seems to me that it would be a lot easier to write ...
Setup:
class A {
public:
void a() {}
};
class B {
public:
void b() {}
};
class C: public A, public B {
public:
void c() {}
};
What (I thought) I should be able to do:
C* foo = new C();
foo->b();
And I get the following linker error from GCC:
`... undefined reference to 'C::b(void)'`
If I use explicit scope re...
I found some C++ code for finding the determinant of matrix, for 4x4 to 8x8. It works ok, but my project needs matrices that are 18x18 or more, and the code is too slow. The code is recursive, but is recursion the right concept to deal with an 18x18 matrix? How else can I find the determinant?
...
Can't figure out what's wrong, I don't seem to be getting anything from fread.
port.h
#pragma once
#ifndef _PORT_
#define _PORT_
#include <string>
#ifndef UNICODE
typedef char chr;
typedef string str;
#else
typedef wchar_t chr;
typedef std::wstring str;
inline void fopen(FILE ** ptrFile, const w...
I am not getting why if there is an active exception then if an exception is raised again, it leads to termination of program. Could someone explain?
...
I have a function to display the values of a vector in a table, but I keep getting an "Undefined symbols" error when linking.
Here is my function prototype:
void displayVectors(vector<string> & nameVec, vector<double> & scoreVec, vector<char> & gradeVec);
Here is the definition:
void dipslayVectors(vector<string> & nameVec, vector<d...
I'm using active object design pattern.
I need a list, which holds user defined objects of the same type. Multiple writers push the objects to the list and readers can wait on the queue in a timed manner.
I know I can wrap an STL list, but maybe there ready solution in boost? I just can't find it.
UPD:
The application runs on Linux ...
Hi,
I'm using Debian x64 2.6.26 to host a server application we've written in C++. Sometimes GDB gets activated on its own and it uses 100% CPU time giving no room for other processes to run. The GDB version is 6.8-debian. I don't know why this happens and how may i prevent this. It seems that it only happens when out server application...
For some reason my buffer is getting filled with jibberish, and I'm not sure why. I even checked my file with a hex editor to verify that my characters are saved in a 2 byte unicode format. I'm not sure what's wrong.
[on file open]
fseek(_file_pointer, 0, SEEK_END);
this->_length = ftell(this->_file_pointer) / sizeof(chr);
[Main]
//...
I am new to Windows environment of development. I see a lot of .rc2 files used where a mapping is performed against some MACRO type constants to strings.
Q1. Why are these .rc2 files used?
Can someone give me a start on these.
...
In a single solution, if I have the same source file present in multiple projects (with different project settings, e.g. different #defines), Intellisense and all the features depending on it seems to arbitrary pick one of the project settings when I edit the source file.
How do I get Intellisense to switch which project settings it use...
It is very easy on Linux to fire-up vi and write a 100-200 lines of code, compile and see the results: ie. Trying small simple examples of C/C++ code.
On windows however, I like Visual Studio but to use it you have create a new solution then a project which then creates a new folder, generates very large PDB and caching files and a smal...
I have a polygon which can be regular as well as irregular one. I have to do offsetting/buffering of polygon. I need to stretch the polygon by some amount of offset. The shape should be maintained.
...