How does this code concatenate the data from the string buffer? What is the * 10 doing? I know that by subtracting '0' you are subtracting the ASCII so turn into an integer.
char *buf; // assume that buf is assigned a value such as 01234567891234567
long key_num = 0;
someFunction(&key_num);
...
void someFunction(long *key_num) {
f...
"We do not use C++ exceptions."
If you don't use exceptions, what happens when there's an error? You just let the program crash?
...
I was talking to a friend of mine that through my new code I didn't treat exceptions, just because I didn't know how to do it in C++. His answer surprised me: "why in the hell would you want to throw excetions?". I asked him why, but he didn't have a satisfying answer, so I googled it. One of the first pages I found was a blog entry, whe...
Are there any viable alternatives to Winsock for C++? The reason I need of is because Winsock's raw sockets are not behaving properly (no, this is not fixable, don't waste your time asking) and WinPCAP can only monitor network traffic, not actually receive packets. I need something that can receive complete packets including any IP, UDP,...
I am following the instructions here for cross-compiling GCC. I am on a mac. When I run this command from the gcc source folder: ./configure --target=i586-elf --prefix=/usr/local/cross --disable-nls --without-headers --enable-languages=c,ada,c++,fortran,java,objc,obj-c++,treelang I get this error: configure: error: GMP 4.1 and MPFR 2.2.1...
Possible Duplicate:
C++ IDE for Linux?
Visual Studio 2010 is absolutely incredible when it comes to it's intellisense and debugger. I've been able to find some decent IDE's for Linux (Ubuntu) that have good auto completion, but I have yet to find one with a debugger as good as Visual Studio. Obviously GCC is different then MSV...
Is it possible to open a folder in Windows Explorer/OS X Finder and then select/highlight one file in that folder, and do it in a cross platform way? Right now, I do something like
QDesktopServices::openUrl( QUrl::fromLocalFile( path ) );
where path is a full path to folder I want to open. Obviously, this will just open the folder, an...
I'm trying to generate a random 64bit unsigned integer using boost random,
but I'm getting an assertion failure with uniform_int.
struct timeval tv;
boost::mt19937 randGen(tval.tv_usec);
boost::uniform_int<> uInt64Dist(0, std::numeric_limits<uint64_t>::max());
boost::variate_generator<boost::mt19937&, boost::uniform_int<> > getRand(rand...
My application has a static control which inside has a tab control. It looks like this:
and I want to handle the topbar's paint event so that after it has drawn itself (and its children), have it floodfill to look more like this:
Given that I'v subclassed the topbar and can override any of its events, how could I do this?
Thanks
...
I started learning about reading the data packed in a Collada file (.dae). I'm to the point where I have the vertices of a specific mesh. Right now, I'm just looping through them between calls to glBegin and glEnd, and I noticed that not all of the faces were being rendered. I think it might be because the vertices aren't in the correct ...
Moving ahead from previous question.I have two rectangle and they look like this:
struct Rect
{
NSPoint topLeft;
NSPoint topRight;
NSPoint bottomLeft;
NSPoint bottomRight;
}
I use something similar code to check whether rectangles intersects(or collision) . In case If 2 rectangles intersects I want to calculate the area of in...
Where should I be looking for resolution of DirectX (3D) device? getViewport seems to have Width and Height, yet as far as I know viewport is supposed to be an area, not 2D "canvas" with these attributes.
(I hope "resolution" applies to the device, not D3D directly. Please correct me if this part is wrong.)
Simple MSDN link will be goo...
HI,
I want to implement Drag and Drop without using Context Menu using Shell extension in C++
Currently I am refering to Shell extension article: http://www.codeproject.com/KB/shell/shellextguide6.aspx
But this article in turn is using Cookies and all .. I am not able to understand that. My requirement is just when I want to drag and d...
i have a own GetTickCount() function returning an unsigned int (the count rolls over to zero on 0xFFFFFFFF)
i cant measure an elapsed time with:
unsigned int elapsed;
unsigned int start = GetTickCount();
LongOperation();
unsigned int stop = GetTickCount();
if (stop >= start )
elapsed = stop - start;
else
elapsed = (INT_MAX - sta...
"A definition for a static data member may be provided in a namespace scope
enclosing the definition of the static member's class template."
It means ...
Is this correct.....
namespace N{
template<typename T>class A{
public:
static int x;
static int fun();
};
}
namespace N1{
template<class T>int A<T>::x=10; }
namespace N2{t...
Hi,
I have a small C++ console application which presents a menu then performs the chosen operation.
In addition, I've written a VBScript which runs over the StdOut (achieved by Exec) and enters to StdIn the values.
However when I'm trying to executet this script the console application is stuck in the scanf call and the script doesn'...
In our application, there are a bunch of unit test console applications that have been written using the boost unit test framework. These test applications form part of the Visual Studio Solution (we are using VS2008 Professional).
Is it possible to run these as part of a Teamcity build?
So far I have configured Teamcity to check out ...
I'm trying to copy a file from one location to another using SHFileOperation:
SHFILEOPSTRUCT fileop;
fileop.hwnd = 0;
fileop.wFunc = FO_COPY;
fileop.pFrom = L"C:\\SomeDirectory\\SomeName.jpg\0";
fileop.pTo = L"C:\\SomeOtherDirectory\\SomeName.jpg\0";
fileop.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT;
fileop.fAnyOperationsA...
While trying to answer this question I wanted to suggest the use of enable_if + disable_if to allow the overload of a method based on the fact that a type was (or not) polymorphic.
So I created a small test file:
template <class T>
void* address_of(T* p,
boost::enable_if< boost::is_polymorphic<T> >* dummy = 0)
{ return...
I know that each programming language has certain guideline and styles. My question is about two languages that I write code in, that isn't very popular or documented.
I know this topic is very broad, and everyone has their own unique way of doing things. What I would like is to hear advantage, disadvantages to certain styles.
In orde...