In my program I need to create sockets and bind them to listen HTTP port (80). The program works fine when I launch it from command line with sudo, escalating permissions to root. Running under XCode gives a 'permission denied' error on the call to binding function (asio::ip::tcp::acceptor::bind()).
How can I do debugging under XCode?
...
Can I do normal computations with iterators, i.e. just increment it by adding a number?
As an example, if I want to remove the element vec[3], can I just do this:
std::vector<int> vec;
for(int i = 0; i < 5; ++i){
vec.push_back(i);
}
vec.erase(vec.begin() + 3); // removes vec[3] element
It works for me (g++), but I'm not sure i...
Hi
Can any body help me in converting Interface Pointer to list variable in vc++ since i am getting the error while typeconversion
error 2440 "type cast" :cannot convert from '_bstr_t' to 'std::list<_Ty>'
so any one plz help me....
Thanks in advance.
Reply:
i Hav done liki this
in C# com i have done like
List Disp()
{
List...
I have a problem that sscanf solves (extracting things from a string). I don't like sscanf though since it's not type-safe and is old and horrible. I want to be clever and use some more modern parts of the C++ standard library. What should I use instead?
...
In my embedded project I have to move(sync) data between two systems.
The data structure is complex and hence need some quick utility.I guess i should convert my data to XML format and sync it using rsync ?
Boost is not going to be there on our embedded platform.
Could someone suggest lightweight yet efficient library to convert my da...
Hi all
how do i disconnect RDP session programatically in c# or c++?
Abdul Khaliq
...
Hello all, I've been brushing up on my C++ as of late, and I have a quick question regarding the deletion of new'd memory. As you can see below i have a simple class that holds a list of FileData *. I created an array to hold the FileData objects to be pushed into the list. When ReportData is destructed I loop through the list and delete...
I'm writing a very basic parser(mostly just to better understand how they work) that takes a user's input of a select few words, detects whether the sentence structure is OK or Not OK, and outputs the result. The grammar is:
Sentence:
Noun Verb
Article Sentence
Sentence Conjunction Sentence
Conjunction:
"and"
"or"
"but"
Noun:
"birds...
Will this code ever wait on the mutex inside the producer's void push(data)?
If so how do I get around that?
boost::mutex access;
boost::condition cond;
// consumer
data read()
{
boost::mutex::scoped_lock lock(access);
// this blocks until the data is ready
cond.wait(lock);
// queue is ready
return data_from_queue();
}
//...
Background: I am writing a C++ program working with large amounts of geodata, and wish to load large chunks to process at a single go. I am constrained to working with an app compiled for 32 bit machines. The machine I am testing on is running a 64 bit OS (Windows 7) and has 6 gig of ram. Using MS VS 2008.
I have the following code:
...
No boost, just plain STL please.
I have a class Foo* mapping to a set of pointers of class ID.
and I need to map a pointer to an instance of ID to a FOO class.
say I have this function:
void FindXXX(const ID* pID)
{
/*find the containing FOO class quickly, but not at expense of an ugly code*/
}
right now I map each ID* to FOO...
Most C++ programmers like me have made the following mistake at some point:
class C { /*...*/ };
int main() {
C c(); // declares a function c taking no arguments returning a C,
// not, as intended by most, an object c of type C initialized
// using the default constructor.
c.foo(); // compiler compla...
What is the windows socket notification sink for? I am currently working with MFC socket and I think I have done something wrong since I get this message at windows shutdown. What could cause this?
Thank you.
Edit:
I am currently working with an application that needs to communicate via sockets. When I shutdown my computer I get a mess...
Hello.
I got this code from a c++ book, and I cannot figure out how the initialization works.
From what I can see, there is an outer for loop cycling trough the rows, and the inner loop
cycling trough the column. But its is the assignment of the values into the array that I do not understand.
#include <iostream>
using namespace std;
i...
I recently asked a question regarding writing a very basic English grammar parser. I thought it might be helpful to show some code (though very ugly) to specify where I need assistance in implementing the grammar. Here is the code. Comments indicate questions.
#include "std_lib_facilities.h"
string sentence();
string noun();
string ver...
I recently acquired some code that I want to port to Linux. In a header file though, I have some curious code that I hope someone can shed some light on. Within a header file, inside a namespace where other classes are defined, I have the following:
#define CREATE_SINGLETON_METHODS(s) \
private: \
friend class Singleton<c>; \
...
I need to find/create a library that can load hdr images in many formats for use in opengl.
I have been using SDL_image, but it doesn't support hdr.
I don't want to use many different image libraries, so if there is one that supports a large amount (bmp, png, jpg, tiff, tga, hdr are the most important).
If there is none, I don't mind ...
I have a c++ console application which I would like to publish using clickonce.
When I run the mageui.exe tool and import the executable and dependent files to make an application manifest, it won't let me set the app.exe as the entry point. I can set the entry point, but when I click off the line and go to save, it clears the dialog an...
For example, I'd like to not indent namespaces in C++ code, but the prefpane doesn't seem to have any place to make a decision of this granularity. Is there some hidden config file or something? Or am I just out of luck?
...
I have a process that interfaces with a library that launches another process. Occasionally this process gets stuck and my program blocks in a call to the library. I would like to detect when this has happened (which I am doing currently), and send a kill signal to all these hung processes that are a child of me.
I know the commands t...