NOTE: I know there are many questions that talked about that but I'm still a beginner and I couldn't understand the examples.
I got a function prototype that goes like this:
int someFunction(const char * sm);
Here, as you know, const char* means that this function can accept const or non-const pointer-to-char. I tried something like ...
I need a way to save and load user configurations for a game (controls, graphics, etc.) to a file. I want to do this in a cross-platform manner, and if I have to use libraries, I want them to have a simple enough syntax. How do I save and load config files, and what format should I use? XML and INI seem popular but all of the parsers I h...
Okay, I have something like this in C++:
class MyClass{
private:
int someVariable;
int someOtherVariable;
struct structName{
int someStructVariable;
int someOtherStructVariable;
};//end of struct
public:
//getters & setters for the defined variables.
int getSomeStructVariable()
{
// this does not work I get ...
What is the difference between
(type)value
and
type(value)
in C++?
...
can i send specific signals to USB ports using Ruby or C++, also the operating system is Windows, so this is like totally new 4 me (to program for windows), so i'm trying to do it as a DLL file, can this DLL contain Ruby code ??
by the way this is just a training project, so it dosn't matter that much, i'm just practicing on those stuff...
I'm new to C++ programming and would greatly appreciate replies that don't assume much prior knowledge.
Thanks to suggestions here, I've created an unordered map:
typedef std::tr1::unordered_map<std::string, Strain*> hmap;
The data in this map are pointers to instances of class Strain. As soon as these instances are created, I create...
I'm working on an embedded project that currently uses C in Linux and uClibc. We're interested in moving it to C++, but I don't want the overhead associated with linking in libstdc++. My impression is that this is possible provided we don't use anything from STL, such as iostream or vector.
How does one direct g++ to compile without li...
Consider one has some user defined types, and containers of those types that are often manipulated because there are often multiple instances of those types on screen at a time.
Currently I have a header with an associated source file and a namespace to hold these containers, but should I create a separate class to hold them? Should I p...
Hi,
I'm attempting to use the #define directive to change all of "ulong" to "unsigned long".
Here is an example:
#define ulong unsigned long
ulong idCounter = 0;
Sadly, I think it ends up replacing ulong with "unsigned", rather than "unsigned long". I tried "#define ulong (unsigned long)", but that didn't worth either.
...
What are the differences between fork() and exec()?
...
Hello,
I was trying to use an STL list in C++ and I arrived into a strange exception that I'm not able to understand.
The list is defined as list<ASTNode*> m_stats; and ASTNode* is a class. When I try to add elements by calling
ASTNode *node = new ASTNode();
m_stats.push_back(node);
it throws the following exception:
Program receive...
Hey everyone!
I know this is rather laughable, but I can't seem to get simple C++ ofstream code to work. Can you please tell me what could possibly be wrong with the following code:
#include <fstream>
...
ofstream File("C:\temp.txt");
if(File)
File << "lolwtf";
Opening the ofstream fails whenever I specify ...
If you have used any decent java or .net IDE you can see the abundance of features that they provide that either do not exist in c/c++ IDEs or exist in a much more limited form.
I am thinking about features like:
Code Completion
Syntax Errors (and compilation errors with no need to compile)
Refactoring
Debugging (the amount of informa...
First, I'm using Qt at the moment. However, I want the program eventually able to run without a GUI environment, leaving the graphical aspects for configuration mainly. The program makes hefty use of Qt timers and signals/slots, partially for QtScript. So if I want to make it non-GUI operable, hopefully parts of Qt can run without a GUI ...
I have a large C++ file (SS.cpp) which I decided to split in smaller files so that I can navigate it without the need of aspirins. So I created
SS_main.cpp
SS_screen.cpp
SS_disk.cpp
SS_web.cpp
SS_functions.cpp
and cut-pasted all the functions from the initial SS.cpp file to them.
And finally I included them in the original file :
#...
I have a struct
struct Packet {
int senderId;
int sequenceNumber;
char data[MaxDataSize];
char* Serialize() {
char *message = new char[MaxMailSize];
message[0] = senderId;
message[1] = sequenceNumber;
for (unsigned i=0;i<MaxDataSize;i++)
message[i+2] = data[i];
return ...
I have developend a window application(Win32 API) in visual C++. I have to add multilingual feature in this application. Can any one Pls guide me how to get forward with this task.
...
i need to present an array on agraph
like function bar(array_name) in matlab
how can i do that in microsoft visual c++ 2008
...
i want to know whether if its possble to access the stack(allocated to the thread which is used to store local variables etc.) content progarmitically .this can help in my effort to programatically determine stack overflow issues.thanks in advance
...
I have been seeing code like this usually in the start of header files
#ifndef HEADERFILE_H
#define HEADERFILE_H
and at the end of the file is
#endif
I am confused about the purpose of this ..?
...