Hello,
is it possible to use prepared statements with the SELECT command?
I wrote in C++ following code:
sqlite3_bind_int(this->ppGetStmt, 1, id);
int rc = sqlite3_step(this->ppGetStmt);
//sqlite3_result_int(this->ppGetStmt, &value);
sqlite3_reset(this->ppGetStmt);
The SQL statement looks like following SELECT value FROM test WHER...
When I use new[] to create an array of my classes:
int count = 10;
A *arr = new A[count];
I see that it calls a default constructor of A count times. As a result arr has count initialized objects of type A.
But if I use the same thing to construct an int array:
int *arr2 = new int[count];
it is not initialized. All values are somet...
Do I have to go over all the program using F11 and F10 . Can't I just mark where I want to go and start from there ?
...
Hi All,
I know how to initialize a static member, but I'm wondering, what is the rationale behind the syntax for this? I'd like to be able to just put the value in the class, a la:
class A {
static const int i = 3;
};
I realise this could mean more rebuilding if I change the value since it's a change in the header - but in some cas...
Can anyone explain me these pointers with a suitable example ... and when these pointers are used?
...
I have a small app that uses Lua linked as dll (not static). I want to load my own c++-written dll via Lua using package.loadlib (libname, funcname). For this purpose I need to export a function that follows the Lua's lua_CFunction protocol. Clearly for that reason I have to incorporate lua.h into my project and use Lua's functions to pa...
Hey. I want to be able to create a system for skeletal animation in my game. I'm using panda3d as my game engine. I'd like to be able to make simple bone structures and skin them with my sprites. I would prefer to do this with straight code and algorithms, but if I have to use a 3D modeler or something, then I can try to (I didn't do a g...
In c++0x is there a way to template a lambda function? Or is it inherently too specific to be templated?
I understand that I can define a classic templated class/functor instead but the question is more like : does the language allow templating lambda functions?
...
In my current project there's some variadic functions being used (ellipsis) that are really being used quite ofen. I have to make some impacting changes to the project, so I thought i might as well get rid of these variadics too.
The question I have is, how does one best replace these if the number of arguments passed to these are so v...
I need to link my C++ programs against a couple shared libraries which generate way too much output to std::cout and std::cerr rendering them both useless for my uses. I have access to the C++ source code of these libraries, but cannot modify them.
Is there a way to redirect their output to a different stream or suppress it when linked ...
#include <google/protobuf/io/coded_stream.h>
namespace google::protobuf::io
....
int fd = open("myfile", O_WRONLY);
ZeroCopyOutputStream* raw_output = new FileOutputStream(fd);
CodedOutputStream* coded_output = new CodedOutputStream(raw_output);
The above is following the tutorial here, but when I compile get the following errors:
er...
#include <iostream>
#include<map>
using namespace std;
map <long long , long long> h;
void sieve(long long start,long long size)
{
long long i,j;
for (i=2; i*i <= size; i++) {
if (!h[i]) {
for(j = i+i; j < size ;j+=i) { h[j] = 1; }
}
}
for (i=2; i<size; i++) {
if (!h[...
I.e. I got 2 specialized types of:
template <class Type, class Base> struct Instruction {};
to compile-time-select the appropriate type from within a type list.
like:
template <class Base> struct Instruction<Int2Type<Add_Type>, Base >
{
void add() {}
};
template <class Base> struct Instruction<Int2Type<Mul_Type>, Base > :
...
This is related to an issue I have been discussing here and here, but as my investigations have led me away from the STL as the potential issue, and towards "new" as my nemisis, I thought it best to start a new thread.
To reiterate, I am using an arm-linux cross compiler (version 2.95.2) supplied by the embedded platform vendor.
When ...
Hi,
I'm a bit hazy on the rules of declarations vs. definitions.
I have the following declaration in funcs.h:
void sumTotalEnrgyAndClush(Protein &A,Protein &B,double ans[2],double enrgyA[18][18],double enrgyB[18][18]);
Notice that ans[2] is before enrgyA and B.
In the funcs.cpp file the definition starts like this:
void sumTot...
I am moving a C++ project from Windows to Linux and I now need to create a build/make file. I have never created a build/make file before. I also need to include Boost libraries to make it more complicated. It must also be a makefile and I need to learn how to create makefile anyway, so CMake and SCON are out. IDEs are also out because o...
In some of its API function Microsoft use the "multi-string" format to specify a list of strings.
As I understand it, a multi-string is a null-terminated buffer of concatenated null-terminated strings. But this can also be interpreted as a list of strings, separated by a null character and terminated by two null characters.
Here comes ...
I am putting a bunch of related stuff into a class. The main purpose is to organize them into a namespace.
class Direction:
north = 0
east = 1
south = 2
west = 3
@staticmethod
def turn_right(d):
return turn_to_the_right
@staticmethod
def turn_left(d):
return turn_to_the_left
# defined a short alias because ...
I have a theory question rather than an error report.
I'm a rookie C++ programmer, trying to promote that away
Using the VC++ VS2008 compiler
I am often finding myself wondering WHY I want to take some actions in header files.
For example look at this code block:
#include "DrawScene.h"
#include "Camera.h"
#include "Player.h"
#includ...
Does anyone know of a tool that generates a makefile by scanning a directory for source files?
It may be naive:
no need to detect external dependencies
use default compiler/linker settings
...