Lower than low level common bsd sockets
How do you do low low level sockets in C, example: actually sending a SYN. ...
How do you do low low level sockets in C, example: actually sending a SYN. ...
Hello, I have a 2D character array: char nm[MAX1][MAX2] = { "john", "bob", "david" }; I want to swap two of these elements (without std::swap) by simply writing swapPointers(nm[0], nm[1]); where swapPointers looks like this void swapPointers(char *&a, char *&b) { char *temp = a; a = b; b = a; } However, this d...
How do you pass options to an executable? Is there an easier way than making the options boolean arguments? EDIT: The last two answers have suggested using arguments. I know I can code a workable solution like that, but I'd rather have them be options. EDIT2: Per requests for clarification, I'll use this simple example: It's fairly ...
A common pattern with STL containers is this: map<Key, Value> map; for(map<Key, Value>::iterator iter = map.begin(); iter != map.end(); ++iter) { ... } So inorder to avoid writing the decleration of the template parameters we can do this somewhere: typedef map<Key, Value> TNiceNameForAMap; But if this map is only used in a single...
So, I've been reading through and it appears that the Boost libraries get used a lot in practice (not at my shop, though). Why is this? and what makes it so wonderful? ...
Boost is meant to be the standard non-standard C++ library that every C++ user can use. Is it reasonable to assume it's available for an open source C++ project, or is it a large dependency too far? ...
I've been reading the legacy code,which invloves in the customized memory pooling system, then I found that the code uses _aligned_malloc. I wonder what is this function and when do I have to use it. ...
First, yes I know about this question, but I'm looking for a bit more information that that. I have actually, a fairly similar problem, in that I need to be able to capture input for mouse/keyboard/joystick, and I'd also like to avoid SDL if at all possible. I was more or less wondering if anyone knows where I can get some decent primers...
I'm trying to start an external application through system() - for example system("ls") - i would like to capture it's output as it happens so i can send it to another function for further processing. What's the best way to do that in C/C++ ? ...
Maps are great to get things done easily, but they are memory hogs and suffer from caching issues. And when you have a map in a critical loop that can be bad. So I was wondering if anyone can recommend another container that has the same API but uses lets say a vector or hash implementation instead of a tree implementation. My goal here...
I'm working on a fairly complex project, a custom encryption routine if you will (just for fun) and I've run into this issue in designing my code layout. I have a number of functions that I want to be able to call by index. Specifically, I need to be able to call one randomly for the encrypt process, but then address that by a specific ...
Say you want to generate a matched list of identifiers and strings enum { NAME_ONE, NAME_TWO, NAME_THREE }; myFunction(NAME_ONE, "NAME_ONE"); myFunction(NAME_TWO, "NAME_TWO"); myFunction(NAME_THREE, "NAME_THREE"); ..without repeating yourself, and without auto-generating the code, using C/C++ macros Initial guess: You could add an ...
To my amazement I just discovered that the C99 stdint.h is missing from MS Visual Studio 2003 upwards. I'm sure they have their reasons, but does anyone know where I can download a copy? Without this header I have no definitions for useful types such as uint32_t, etc. ...
After I messed up the description of my previous post on this I have sat down and tried to convey my exact intent. I have a class called P which performs some distinct purpose. I also have PW which perform some distinct purpose on P. PW has no member variables, just member functions. From this description you would assume that the code...
I want to execute a certain batch file and redirect its console output to a text control in visual c++ or redirect the console output at the same time the logs/echo are showing. ...
During a long compilation with Visual Studio 2005 (version 8.0.50727.762) I sometimes get the following error in several files in some project: fatal error C1033: cannot open program database 'v:\temp\apprtctest\win32\release\vc80.pdb' (The file mentioned is either vc80.pdb or vc80.idb in the project's temp dir.) The next build of the sa...
I'm translating a library written in C++ to C#, and the keyword 'union' exists once. In a struct. What's the correct way of translating it into C#? And what does it do? It looks something like this; struct Foo { float bar; union { int killroy; float fubar; } as; } ...
In a destructor, is there a way to determine if an exception is currently being processed? ...
What I'm looking for is a simple timer queue possibly with an external timing source and a poll method (in this way it will be multi-platform). Each enqueued message could be an object implementing a simple interface with a virtual onTimer() method. ...
Suppose I want to implement in C++ a data-structure to store oriented graphs. Arcs will be stored in Nodes thanks to STL containers. I'd like users to be able to iterate over the arcs of a node, in an STL-like way. The issue I have is that I don't want to expose in the Node class (that will actually be an abstract base class) which STL...