c++

coclass in .idl import interface defined elsewhere?

I have an IDL file that defines a few interfaces followed by a coclass. Can I make this class import interfaces that are not defined in this class? ...

std::getline and eol vs eof

I've got a program that is tailing a growing file. I'm trying to avoid grabbing a partial line from the file (e.g. reading before the line is completely written by the other process.) I know it's happening in my code, so I'm trying to catch it specifically. Is there a sane way to do this? Here's what I'm trying: if (getline (stream,...

Scrollbar flicker

I have a problem with the way my scrollbars are drawn. Because of external limitations (my application being a plugin running in an external window that insists on painting over any regular child window), I have to use SCROLLBAR-class windows (as opposed to using WS_CHILD | WS_VSCROLL) For almost every message received, the scrollbar is...

How do I use CharNext in the Windows API properly?

I have a multi-byte string containing a mixture of japanese and latin characters. I'm trying to copy parts of this string to a separate memory location. Since it's a multi-byte string, some of the characters uses one byte and other characters uses two. When copying parts of the string, I must not copy "half" japanese characters. To be ab...

attached process error VS C++ .NET

When I go to Debug -> Start I get the error: "Unable to attach to machine 'mypc' Do you want to continue anyway? YES/NO I did not attach a proces and am not sure why it is coming up. (Also, when I hit YES to the error, it does not run.) How do I remove all attachments on the debugger? ...

How should a .NET developer learn C++ ?

Ok. Here is a summary of my experience/knowledge/etc listed: I have only worked with 2 languages: C# and F# I am only familiar with programming in a managed environment I have a solid understanding of C# syntax I have a solid understanding of C#'s type system I have never looked at a line of C++ code I do not know C++'s type system ...

Why does the original CString get overwritten when passing a copy to the DrawText function with the DT_MODIFYSTRING option?

I've already found a workaround to this problem, but was just wondering if anyone knew what was actually happening to cause the problem I was seeing. My guess is that it has something to do with mutability of strings, but I thought the CString object accounted for that in the copy constructor. The following code causes mFileName to be ...

C++ Using windows named pipes

For some reason both the mast and slave fail, however I could find any good examples on how their meant to work, so im not sure where I went wrong. The master never exits the WaitForSingleObject after ConnectNamedPipe, and the slave throws an exception in the first boost::asio::read call, "Waiting for a process to open the other end of...

How to access elements of a C++ map from a pointer?

Simple question but difficult to formulate for a search engine: if I make a pointer to a map object, how do I access and set its elements? The following code does not work. map<string, int> *myFruit; myFruit["apple"] = 1; myFruit["pear"] = 2; ...

Incorrect floating point math?

Hello everyone, Here is a problem that has had me completely baffled for the past few hours... I have an equation hard coded in my program: double s2; s2 = -(0*13)/84+6/42-0/84+24/12+(6*13)/42; Every time i run the program, the computer spits out 3 as the answer, however doing the math by hand, i get 4. Even further, after inputti...

How to make OpenGL apps in 64-bits windows

OpenGL experts, My project compiles, link and run in xp32 then I tried to cross compile it to x64 and I came across a lot of questions. There's no native x64 instalable OpenGL SDK so I link against what? I saw someone saying that x64 apps use 32bits opengl dll. I tryied to run my compiled 64-bits app in a xp64 with drivers to my video...

Using an existing C++ engine on the iPhone

I come from a C/C++ background and more recently flash. Anyway I wrote a 2D engine in AS3 and would like to get it running on the iPhone. To start with I converted it to C++. As a test I wrote a very simple C++ engine and added the files to a standard view-based application in XCode. I then added a UIImageView that covered the whole iPho...

Compiling C++ Code With Boost's Numeric Binding Library to Solve Ax=b Linear System

I am using Numeric Library Bindings for Boost UBlas to solve a simple linear system: #include<boost/numeric/ublas/matrix.hpp> #include<boost/numeric/ublas/io.hpp> #include<boost/numeric/bindings/traits/ublas_matrix.hpp> #include<boost/numeric/bindings/lapack/gesv.hpp> #include <boost/numeric/bindings/traits/ublas_vector2.hpp> namespac...

Retrieving paths of FileSystemInfo instances

How does one retrieve ( or resolve, for that matter ) the absolute and relative ( FullPath and OriginalPath fields ) paths of FileSystemInfo/DirectoyInfo/FileInfo instances ? I'm trying to get the paths of the files/directories returned by a FileSystemInfos call on a DirectoryInfo class object. ...

compiling c++ into "real" programs

hey, I know how to use g++ and all that to compile c++ programs. My question is, if I have some code which depends on various libraries, how can I compile it into a simple executable that I can send anyone. For this I would be happy with just keeping it on os x. I would like to know how to compile a "real" program not just an executable...

About write buffer in general network programming

I'm writing server using boost.asio. I have read and write buffer for each connection and use asynchronized read/write function (async_write_some / async_read_some). With read buffer and async_read_some, there's no problem. Just invoking async_read_some function is okay because read buffer is read only in read handler (means in same thr...

Quick Question: Why do VC++ compiled exe's stop working if I change their names?

I'm working on a command prompt roguelike in VisualC++ 2008, and everything compiles all fine and dandy, but there's one glaring issue that I have with it. Why is it that if I change the name of the exe, the program fails completely? I don't think that's supposed to happen with most programs ...

Linking Nvidia's Cg framework statically in Xcode

10 billion kudos for life to anyone who can figure this one out. Nvidia only provides a standard framework for Cg, which I cannot figure how I can link statically. I need to link it statically because it's for a plugin. Is there any way at all this can be done? ...

How sets,multisets,maps and multimaps works internally

Hello, I have few questions regarding this topic. How does multiset works? I mean if set cant have value mapped to a key and it only holds keys? Also how all of these associative containers works? I mean vector and deque in the memory is hold sequentially it means that deleting/removing(except beggining(deque) and end(vector,deque) is sl...

C++ method declaration question

I have some code in Image.cpp: Image::Image( int width, int height, int depth ) : m_sFileName(0) { ... } and in Image.h: class Image: public DrawAble, public RenderAble { ... private : std::string *m_sFileName; }; My question is: what is happening with m_sFilename in the first line? I guess it is set to NULL...