c++

Convert BYTE buffer (0-255) to float buffer (0.0-1.0)

How can I convert a BYTE buffer (from 0 to 255) to a float buffer (from 0.0 to 1.0)? Of course there should be a relation between the two values, eg: 0 in byte buffer will be .0.f in float buffer, 128 in byte buffer will be .5f in float buffer, 255 in byte buffer will be 1.f in float buffer. Actually this is the code that I have: for (...

What programming skills I need to become an iPhone developer?

I have almost 3 years of programming experience in windows world. I know C and C++ (part of my college education) and have been working on Delphi and C# professionally. I am thinking about learning some iPhone development stuff. What programming/software skills I need to dive in? ...

Process name change at runtime (C++)

Is it possible to change the name(the one that apears under 'processes' in Task Manager) of a process at runtime in win32? I want the program to be able to change it's own name, not other program's. Help would be appreciated, preferably in C++. And to dispel any thoughts of viruses, no this isn't a virus, yes I know what I'm doing, it's ...

How to pass 2 string lists to c++ from c# through COM?

Hi I need to pass string lists to unmanaged c++ how can i do this ?? I have used IDictionary as method return type and send through com but it doesn't work How to achieve this. i write in c# as follows IDictionary postNames() { IDictionary post=Dictionary(); post.Add("Raj"); post.Add("Mahesh"); post.Add("john steek"); return...

How to split the strings in vc++?

Hi I have a string "stack+ovrflow*newyork;" i have to split this stack,overflow,newyork any idea?? ...

DebugBreak not breaking

I'm writing a class in C++ that I cannot debug by using F5. The code will run from another "service" that will invoke it. In the past I've used __debugbreak() and when I got a window telling me that an exception was thrown selected to debug it. Recently I've updated to windows 7 and it kept working for a while. Today when I've tried t...

Multi-way tree

How do you find the height of a multi-way tree? A binary tree looks something like this... int height(node *root) { if (root == NULL) return 0; else return max(height(root->left), height(root->right)) + 1; } I cant figure it for multi-way. ...

How to use DSP to speed-up a code on OMAP?

I'm working on a video codec for OMAP3430. I already have code written in C++, and I try to modify/port certain parts of it to take advantage of the DSP (the SDK (OMAP ZOOM3430 SDK) I have has an additional DSP). I tried to port a small for loop which is running over a very small amount of data (~250 bytes), but about 2M times on diffe...

What is a good project / way for an out of practice C++ developer to get back into it?

Like many people here, I started my programming experience with the good ol' green screen BASIC that you get when you booted an Apple II without a disk. I taught myself C++ in my teens, and even took a class on it in college, but as soon as I discovered .NET and C#, I dropped C++ like a bad habit. Now, (many) years later, I'm interested ...

Why does boost::variant not provide operator !=

Given two identical boost::variant types a and b, the expression ( a == b ) is permitted. However ( a != b ) seems to be undefined. Why is this? ...

Unpacking an executable from within a library in C/C++

I am developing a library that uses one or more helper executable in the course of doing business. My current implementation requires that the user have the helper executable installed on the system in a known location. For the library to function properly the helper app must be in the correct location and be the correct version. I wo...

How to keep asynchronous parallel program code manageable (for example in C++)

I am currently working on a server application that needs to control a collection devices over a network. Because of this, we need to do a lot of parallel programming. Over time, I have learned that there are three approaches to communication between processing entities (threads/processes/applications). Regrettably, all three approaches ...

Bitfield manipulation in C

The classic problem of testing and setting individual bits in an integer in C is perhaps one the most common intermediate-level programming skills. You set and test with simple bitmasks such as unsigned int mask = 1<<11; if (value & mask) {....} // Test for the bit value |= mask; // set the bit value &= ~mask; // clear the bit ...

BSD Socket issue: inet_ntop returning "0.0.0.0"

I'm trying to get the IP of the machine a socket I've bound is listening on. The port number printed works fine, but the address is "0.0.0.0". Here's the relevant code. res has been passed to getaddrinfo and getsockname before getting to this code. char ip[INET_ADDRSTRLEN]; struct sockaddr_in *ipv4 = (struct sockaddr_in *)res->ai_addr; ...

How do you pass boost::bind objects to a function?

I have a one-dimensional function minimizer. Right now I'm passing it function pointers. However many functions have multiple parameters, some of which are held fixed. I have implemented this using functors like so template <class T> minimize(T &f) { } Functor f(param1, param2); minimize<Functor>(f); However the functor definition...

C++ auto_ptr for arrays

In short, I am wondering if there is an auto_ptr like type for arrays. I know I could roll my own, I'm just making sure that there isn't already something out there. I know about vectors as well. however I don't think I can use them. I am using several of the Windows APIs/SDKs such as the Windows Media SDK, Direct Show API which in or...

Can this checksum algorithm be improved?

We have a very old, unsupported program which copies files across SMB shares. It has a checksum algorithm to determine if the file contents have changed before copying. The algorithm seems easily fooled -- we've just found an example where two files, identical except a single '1' changing to a '2', return the same checksum. Here's the al...

Automating RegisterClass in C++ Builder VCL

We use C++ Builder for an application whose forms are kept external to the EXE in a database. Application code is C++ This allows us to modify the forms and form/actions without a re-compile. Here is a snippet of code that gets the job done of loading a form. RegisterClass(__classid(TButton)); RegisterClass(__classid(TEdit)); Regi...

API for streaming audio

Hi Can you recommand a API to prorammatically feed sound data (wav or something) into to get in the end an streaming server someone can connect to with e.g. winamp? In my szenario I have some wave samples and would like to "create" sounds/music with them streaming the result to an audience on the fly. My prefered language is C++ (on Re...

How to set TCP_NODELAY on BSD socket on Solaris?

I am trying to turn off Nagle's algorithm for a BSD socket using: setsockopt(newSock, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof flag); but the compiler claims TCP_NODELAY hasn't been seen before: error: `TCP_NODELAY' undeclared (first use this function) This is the full list of includes for the file this is in: #include <arpa...