Okay so I'm trying to make a file browser program, and I'm in the basics right now but this line here:
fprintf(stderr, "stat returned %i\n", stat(files[curser].c_str(), &st));
Says that stat is returning -1 (fail) and I am wondering why. Can anyone tell me? Here is the full source:
#include <SDL/sdl.h>
#include <SDL/sdl_image.h>
#in...
I am writing C / C++ code to run a shell command and capture the output:
static const int BUFFER_SIZE=512;
// (...)
FILE* pipe;
char buffer[BUFFER_SIZE];
// (...)
if (!(pipe = popen(cmd.c_str(), "r"))) {
out("\nProblem executing command: " + cmd + "\n");
return 1;
}
while (!feof(pipe)) {
int read = fread(buffer, sizeof(char),...
The program is successfully compiled but when I try to convert the following infix expression 'A * B + C / D', I get this error message: Segmentation fault (core dumped). It works for some expression like this ' a+b-c*d/e' but i don't know is it correct or not.
#include<iostream>
#include<stack>
#include<string>
using namespace std...
I am currently using map<int, int> in C++. I can check for the existence of a key without a problem but is there an efficient way to retrieve the keys that a particular value has as well? My purpose is to grab all the elements with a given value and then update their value.
...
I get the following error:
1>c:\documents and settings\krzys\desktop\desktop icons\ollydbg\plugins\odbgscript\OllyLangCommands.cpp(3602): error C2593: 'operator =' is ambiguous
1> c:\documents and settings\krzys\desktop\desktop icons\ollydbg\plugins\odbgscript\var.h(45): could be 'var &var::operator =(const long double &)'
1> ...
I am trying to run a boost example but I am getting the following error:
g++ bimap.cpp -o bimap
bimap.cpp:1:28: error: boost/config.hpp: No such file or directory
bimap.cpp:8:27: error: boost/bimap.hpp: No such file or directory
bimap.cpp: In function 'int main()':
bimap.cpp:27: error: 'boost' has not been declared
bimap.cpp:27: error: ...
Possible Duplicate:
error C2593: 'operator =' is ambiguous; Compiled fine on VS6, but I get that error on VS10
I get the following error:
1>c:\documents and settings\krzys\desktop\desktop icons\ollydbg\plugins\odbgscript\OllyLangCommands.cpp(3602): error C2593: 'operator =' is ambiguous
1> c:\documents and settings\k...
Hi,
I recently created a landscape code which I full understand, and added some diffuse lighting to the scene. However to my disappointment there was no shadows. I looked around the web for hours, looking for ways to get shadows in OpenGL, however they all seemed terribly complicated; and very unique to their own demo programs.
Is thei...
Possible Duplicate:
Potential Problem in Swapping values of two variables without using a third variable
I recently read in a community that we can easily swap two numbers without using third using a XOR trick.
m^=n^=m^=n; trick was mentioned.
What do you guys think? Is this trick always useful?
...
I have those two classes
///////////BASE CLASS
class Base{
public:
Base(int = 0);
~Base();
Base(Base&);
Base(Derived&); ////<-may be problem here?, note: I tried without this function
int valueOfBase();
protected:
int protectedData;
private:
int baseData;
};
/////////////DER...
Hello!
I am working on a personal project involving sending simple signals from my computer to a circuit via USB. Basically I am using the USB signal as the gate signal for a MOSFET which will in turn activate a relay to turn on/off various AC peripherals. For example if I want to turn on a light bulb for 5 seconds every minute I would ...
Hi,
My code compiles and run, but i've been told that it is quite problematic. I don't understand where do i go wrong.
Also, isn't it suppose to be wrong to declare "char _arrName[2];" and to do the assignment "_arrName[2]= '\0';" ? Isn't is a "out of boundaries" bug?
#include <iostream>
using namespace std;
class Base {
protected:
cha...
In C, it's not an error to cast pointers to and from void *.
A major obstacle in porting to C++ is the need to cast pointers when returning from functions dealing with generic pointers such as malloc, and functions declared in my own code such as void *block_get(Blkno const blkno);.
My code however is intended to be compiled by C and C...
Possible Duplicates:
Empty class in C++
What is the size of an empty struct in C?
I read somewhere that size of an empty struct in C++ is 1. So I thought of verifying it.
Unfortunately I saved it as a C file and used <stdio.h> header and I was surprised to see the output. It was 0.
That means
struct Empty {
};
int main(v...
Hello,
I'm writing a C++ application which shall be locale independent, so I decided to use UTF-16 as my in-memory representation for strings/texts (the application should be as platform independent as possible). For localize the application's messages i want to use GNU's gettext library. Since this library seems to use GNU's libunistri...
I created some class:
class Base{
public:
Base(int = 0);
~Base();
Base(Base&);
Base(Derived&); //<- here
int valueOfBase();
protected:
int protectedData;
private:
int baseData;
};
class Derived: public Base{
public:
Derived(int = 0);
Derived(Derived&);
~Derived();
private:
int derivedData;
};
###//Impplementatio...
Hi All,
I would like to know when is a vtable created?
Whether its in the startup code before main() or is it at some other point of time??
Thanks & Regards,
Sen
...
Hi,
I'm writing a Matrix program: I have a class to represent a Regular matrix (RegMatrix), and a class to represent a sparse matrix (SparseMatrix), that is: represent only the none-zero's values.
In the begining of each H file, i write the opposite class declaration. For example, in SparseMatrix.h I write class RegMatrix (so that the c...
I just found out about the Boost Phoenix library (hidden in the Spirit project) and as a fan of the functional-programming style (but still an amateur; some small experience with haskell and scheme) i wanted to play around with this library to learn about reasonable applications of this library.
Besides the increasement of expressivenes...
what exactly does it mean from technical point of view, I understood that it means that my derived class can always be converted to base class, that's it? I read some materials without any reference to technical aspects, only philosophy! thanks in advance
...