c++

Whats the deal with boost.asio and file i/o?

I've noticed that boost.asio has a lot of examples involving sockets, serial ports, and all sorts of non-file examples. Google hasn't really turned up a lot for me that mentions if asio is a good or valid approach for doing asynchronous file i/o. I've got gobs of data i'd like to write to disk asynchronously. This can be done with nativ...

Specify ordinals of C++ exported functions in a DLL

I am writing a DLL with mixed C/C++ code. I want to specify the ordinals of the functions I'm exporting. So I created a .DEF file that looks like this LIBRARY LEONMATH EXPORTS sca_alloc @1 vec_alloc @2 mat_alloc @3 sca_free @4 vec_free @5 mat_free @6 ... I would like to specify the ordina...

How do you change an IP address in C++?

I need to do a number of network-related things in C++ that I would normally do with ifconfig in Linux, but I'd like to do it without parsing the output of a group of system calls. Which C or C++ libraries can I use to tell if a network adapter is up or down, read or change an adapter's IP address and netmask, and change the default DNS...

C++ namespaces: cross-usage

Consider the following example. It consists of two header files, declaring two different namespaces: // a1.h #pragma once #include "a2.h" namespace a1 { const int x = 10; typedef a2::C B; } and the second one is // a2.h #pragma once #include "a1.h" namespace a2 { class C { public: int say() { return a1::x...

Diamond inheritance (C++)

I know that having diamond inheritance is considered bad practice. However, I have 2 cases in which I feel that diamond inheritance could fit very nicely. I want to ask, would you recommend me to use diamond inheritance in these cases, or is there another design that could be better. Case 1: I want to create classes that represent diffe...

Can I extend lisp with c++?

Can I call a function from lisp from a library written in c or c++? How can I extend lisp? This is useful when you want to do some system calls or stuff like that. ...

To Use GOTO or Not?

Hi Currently I am working on a project where goto statements are heavely used. The main purpose of goto statements is to have one cleanup section in routine rather than multiple return statements. Like below BOOL foo() { BOOL bRetVal = FALSE; int *p=NULL; p = new int; if(p==NULL) { cout<<" OOM \n"; goto Exit...

C++ and SOAP -> how to start well

My project is about to introduce SOAP. It's going to be used for C++ <-> Java and C++ <-> Flex communication. I'm responsible for refactoring our apps to take advantage of Java business rules engine and new Flex gui. What resources are must read for C++ SOAP? I've read W3 materials. We're probably be using gSOAP on Solaris boxes. ...

How to learn boost

I've heard so many comments in SO and other places about boost libraries that I finally decided to learn them. Can anyone recommend me some tutorial or online book? ...

Is Boost guilty of being un-Boost-like?

I was just reading the intro to the Boost::Spirit LL Parser framework. The preface suggests that the author and creator likes to use such parsing technology to read in program options. Doesn't Boost have its own library for program options? I am wondering, does the Boost committee review all the library notes for common themes and style...

Avoiding Inheritence Madness

So, I have an API that I need to implement in to an existing framework. This API manages interactions with an external server. I've been charged with coming up with a way to create an easily repeatable "pattern," so that if people are working on new projects in the given framework they have a simple solution for integrating the API. ...

Finding gaps in sequence of numbers

I have a std::vector containing a handful of numbers, which are not in any particular order, and may or may not have gaps between the numbers - for example, I may have { 1,2,3, 6 } or { 2,8,4,6 } or { 1, 9, 5, 2 }, etc. I'd like a simple way to look at this vector and say 'give me the lowest number >= 1 which does not appear in the vect...

How much slower is a wxWidget written in Python versus C++?

I'm looking into writing a wxWidget that displays a graphical node network, and therefore does a lot of drawing operations. I know that using Python to do it is going to be slower, but I'd rather get it working and port it later when its functional. Ideally, if the performance hit isn't too great, I'd prefer to keep the codebase in Pyt...

SEL_E_SECPKG_NOT_FOUND error from AcquireCredentialsHandle()

Hi, I get the above error when trying to run the code from Microsoft's Secure SOAP sample http://msdn.microsoft.com/en-us/library/s2ya483s.aspx The call, from M'soft's code, seems to be correct: Status = g_Sample_SecurityInit._SecurityFunc.AcquireCredentialsHandleA( NULL, // Name of principal UNISP_NAME_A...

Useful Add-Ins or Plug-Ins for native Visual Studio developer

There are plenty of different Add-Ins for Visual Studio, see Visual Studio Gallery . Please share your experiences and favorites. As motivation, here are some of my favorites: Versioning Controlled Build [F/O] - very handy extension for automatic build numbering, SlickEdit Gadgets [F] - useful editor gadget, build-in file explorer, .....

How to diagnose Access Violation on application exit

I have an application that I'm trying to debug a crash in. However, it is difficult to detect the problem for a few reasons: The crash happens at shutdown, meaning the offending code isn't on the stack The crash only happens in release builds, meaning symbols aren't available By crash, I mean the following exception: 0xC0000005: Acc...

(C++) While reading a file (ifstream), is there any way to direct it to make a new line?

While reading a file (ifstream), is there any way to direct it to make a new line? For instance, I would like for THIS to happen: myfile>>array[1]>>array[2]>>endl; Obviously, the "endl" just isn't allowed. Is there another way to do this? Edit---thanks for the quick responses guys! From a text file, I'm trying to store two strings...

How to implement One Definition Rule

This post reference to the One Definition Rule. Wikipedia is pretty bad on explaining how to implement it Where can I find good ressources about guidelines to follow in C++ .NET? ...

(C++) Need help with database

I'm trying to make a database and so far, I've been using strings to store my entries from a text file into an array, but this just isn't working out. Thus, I began thinking of a new way of doing it. What I want to do: Lets say I have a text file with the following database... John Smith 00001 jsmith@email pw1 Rob Deniro 00002 ...

error LNK2001 and error LNK2019 (C++) -- Requesting some learning about these errors

Alright, so I just finished my last compiler error (so I thought) and these errors came up: 1>GameEngine.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" (?PI@WeaponsDB@@2NA) 1>Component.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" (?PI@WeaponsDB@@2NA) 1>Coord...