If i have an array of coordinates for a path(Such as in a paint program), what is the best way to render the entire path with SDL?
I looked at setting pixels individually, but from what i've seen that's a bad idea.
I also thought about drawing all the coordinates as SDL_Rect's, but rendering a large list of rect's each frame sounds sl...
In PHP, there is a str_replace function that basically does a find and replace. Is there an equivalent of this function in C++?
...
My program crashes when it tries to assign one object to the other, do you guy see anything wrong with this?
The variables are:
Field *fields[50];
int numOfFields;
int currentField;
The function is:
Screen& operator=(Screen &scr) {
if (this != &scr){
for (int i = 0; i < 50; i++)
fields[i] = NULL;
for (int i = 0; i <...
I'd like to create a variable which matches the type of another variable by way of a template such that if the other variable ever changes type to match, the one derived from it via a template also changes its type.
How can I do this with templates in C++?
The purpose is to ensure that when I read from disk into a temporary variable th...
Error:
..\Record.cpp: In function `std::ostream& operator<<(std::ostream&, Record&)':
..\Record.cpp:83: error: no match for 'operator<<' in 'out << Record::date()()'
Record.cpp:
/*
* Record.cpp
*
* Created on: Jun 13, 2010
* Author: DJ
*/
#include <iostream>
#include "Record.h"
using std::string;
using std::istream;
using...
I was successfully to finally be able to use TUI header from PDcurses library in my C++ project in a previous post here.
now in my class I am including the C header:
#include "tui.h"
tui is in C and has this definition for menu:
typedef struct
{
char *name; /* item label */
FUNC func; /* (pointer to) function */
char *...
As in, should the operator>> match the operator<< ?
Database Example:
If the operator>> reads in something of the following format:
2
Joe 500 20 1
Bob 250 30 0
should the operator<< output that? Or something like this:
Record: 1/2
Name: Joe
Balance: 500
Transactions: 20
Premium Account: Yes
And then have a separate writeFile() fu...
I'm using pure win32. How can I use 24 bit images instead of 8 bit?
Thanks
...
In the below program , I intend to read each line in a file into a string , break down the string and display the individual words.The problem I am facing is , the program now outputs only the first line in the file. I do not understand why this is happening ?
#include<iostream>
#include<string>
#include<fstream>
#include<cstdio>
using ...
Trying to compile a game, but getting 100+ errors like:
C:\Users\AppData\Local\Temp\cctQCagR.o: In function `load_image(std::string)':
main.cpp:(.text+0x4bd4): undefined reference to `std::string::c_str() const'
C:\Users\Bill\AppData\Local\Temp\cctQCagR.o: In function `createShip(float, float)':
main.cpp:(.text+0x4da4): undefined refere...
I have read some vague statement that virtual inheritance doesn't provide the memory structure required by COM, so we have to use the normal inheritance. Virtual inheritance is invented to handle the diamond problem.
Could someone show me an illustration of the difference of memory structure details between this two inherit approaches? ...
Given two arrays A[n] and B[m], how can I find the smallest window in A that contains all the elements of B.
I am trying to solve this problem in O(n) time but I am having problem doing it. Is there any well know algorithm or procedure for solving it.
...
Starting from this example: http://support.microsoft.com/kb/828736 I have tried to add a test function in my C# DLL which takes strings as parameters. My C# DLL code is as follows:
namespace CSharpEmailSender
{
// Interface declaration.
public interface ICalculator
{
int Add(int Number1, int Number2);
int StringT...
I have a std::vector of function objects. Each object can take an int, so I can say obj(4) and get an int result. How can I use the algorithm for_each to work on each element of the vector?
...
I do not understand how this piece of code (from Wikipedia) works:
template <int N>
struct Factorial
{
enum { value = N * Factorial<N - 1>::value };
};
template <>
struct Factorial<0>
{
enum { value = 1 };
};
// Factorial<4>::value == 24
// Factorial<0>::value == 1
void foo()
{
int x = Factorial<4>::value; // == 24
i...
I have a base class pointer pointing to derived class object. I am calling foo() function by using two different ways as mentioned below in Code. I want to know why in first case Derived:foo() is getting called.
Shouldn't (*obj).foo() call Base:foo() function as it has already been dereferenced ?
class Base
{
public:
...
What was the raionale behind having a function by the name IsDirty() in CField Class in MFC.
...
const int bob = 0;
if(bob)
{
int fred = 6/bob;
}
you will get an error on the line where the divide is done:
"error C2124: divide or mod by zero"
which is lame, because it is just as inevitable that the 'if' check will fail, as it is the divide will result in a div by 0. quite frankly I see no reason for the compiler to even eval...
Maybe 1 times out of 5, I get this error on a specific machine (incidentally, our buildbot) but it never occurs on my dev machine. I'm hoping that there's a hotfix for this from Microsoft, but I can't find one.
LINK : fatal error LNK1104: cannot open file 'Debug\synergy.lib'
It might be worth noting that this is using the 64-bit build...
WinXP, Vista, Win7, there is a certain folder for recyclebin.
How Can I get the recycleBin Path for each disk, for different operation System?
in WinXP it is called XX:\RECYCLER, while in vista it used another name.
Is there any windows C++ API for it ?
Many thanks!
...