c++

c++ equivalent of JMX ?

Can any one suggest c++ equivalent of JMX ? ...

Cannot set OdbcConnection to OdbcCommand.Connection

Hi, On the class level, I have created reference: System::Data::Odbc::OdbcConnection Connection; in some method I want to set it to odbcCommand.Connection like this: ::System::Data::Odbc::OdbcCommand Command; Command.Connection=this->Connection; It reports "cannot convert parameter 1 from 'System::Data::Odbc::OdbcConnection' to 'Syst...

Reading float value from string upto 6 precision

Hi i have to read a flot value from string up to 6 precision , Current code is reading first 6 digits only. Thanks in Advance template <class T> bool from_string(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&)) { std::istringstream iss(s); return !(iss >> f >> t).fail(); } int main() { int i...

How to implement server-sided applications that can process user's inputs?

There are some web-based services such as converting .flv files into .mp3 files, .doc files into .pdf files, etc. These are the servers that take files from the user and apply respected applications (such as conversion). After that, the converted file may be available to the requested user. I understand a little bit about writing a text...

Getting a file path relative to a particular directory

Is there a nice way in the WinAPI to get a path relative to another path? For example: Have a list of paths relative to: a\b\c\d And I'd like to change them all to paths relative to a\b\c Is there a neat way to do this or should I get path parsing? ...

Print a GUID variable

I have a GUID variable and I want to write inside a text file its value. GUID definition is: typedef struct _GUID { // size is 16 DWORD Data1; WORD Data2; WORD Data3; BYTE Data4[8]; } GUID; But I want to write its value like: CA04046D-0000-0000-0000-504944564944 I observed that: Data1 holds the dec...

How to get the value of a value passed by reference in C++

I have a function with the following declaration: void cleanValid(int valid[][4], int &size, int index); In implementation of this function I need to set another counter equal to the integer size passed by reference. I tried doing something like: int count; count = size; If I'm not mistaken, when I change the value of count it will...

OpenCV matrix access produces EXC_BAD_ACCESS

When I run the following program with scalefactory higher than 1.5, the program throws an EXC_BAD_ACCESS. The program scales an image. #include <iostream> #include <OpenCV/cv.h> #include <OpenCV/highgui.h> #include <cmath> using namespace std; using namespace cv; int scale (int xyvalue, float scalefactor) { return ceil(xyvalue/sca...

Setting up a camera in OpenGL

I've been working on a game engine for awhile. I've started out with 2D Graphics with just SDL but I've slowly been moving towards 3D capabilities by using OpenGL. Most of the documentation I've seen about "how to get things done," use GLUT, which I am not using. The question is how do I create a "camera" in OpenGL that I could move...

finding numbers with C++

Hello, I have a problem in writing a program with C++. I have been studying C# and Java but C++ is a way different to me, so I need your help. My task is to make program which: reads an input from a text box than returns the nubers from that input which has two digits and their sum is 9. For example: Input: 12 231 81 53 522 11 63 Ou...

C++ Unicode Encryption Library Required (Or is it?)

I need to encryption several pieces of text in a file along side unencrypted text in the same file. All the data is Unicode text. In all the encryption libraries I have looked at Crypto++ Botan Etc... None of them "appear" to provide Unicode aware methods for encrypting / decrypting data E.G. data can be passed in/out using char, stri...

c++: pass function as parameter to another function

i am currently implementing a binary tree in c++ and i want to traverse it with a function called in_order(). is there any way to pass a function as an argument, so that i can do things like below (without having to write the code to traverse the list more than once)? struct tree_node; // and so on class tree; // and so on void ...

How to Convert Byte* to std::string in C++?

I have Byte *, want to convert it to std::string. Can you please tell me the safest way to do this? ...

freopen: reverting back to original stream

Hello, I needed to forward stdout to different files to separate some prints produced and the reverting back to normal stdout. I used freopen to switch to the file in this way: char name[80]; memset(name, 0, 80); strcpy(name, "./scripts/asm/"); strcat(name, m_func->m_name->m_value); strcat(name, ".shasm"); freopen(name, "w", stdout); ...

C/C++ compiler feedback optimization

Has anyone seen any real world numbers for different programs which are using the feedback optimization that C/C++ compilres offer to support the branch prediction, cache preloading functions etc. I searched for it and amazingly not even the popular interpreter development groups seem to have checked the effect. And increasing ruby,py...

How do I enumerate network adapters and get their MAC addresses in Win32 API C++ ?

As the title says, I've been trying to achieve that for the better part of the day. Any help would be apreciated. ...

cutting audio files based on a keyword

Hi, I have a audio file(s) that need to be cut and broken up into multiple audio files based on a keyword. For example, lets say the keyword is "CUT" if we had an wav file called "original.wav" with the following audio, "Hello , is this CUT the time is CUT My name is CUT The balance is" and the token audio cut.wav which contains the...

Is this casting?

Hi guyz. Sorry for not even knowing what to title this, but here goes. Suppose I have: char Fred[] = "1234 Evergreen Terrace"; char Pete[] = "4567 State Street"; char Mark[] = "123 North Street"; char Name[32]; gets(Name); instead of writing: if(strcmp(name,"Fred")==0); printf("You live at %s\n",Fred); else if(strcmp(name,"Pete"...

NULL definition problem on 64 bit system

I'm running on RHEL 5.1 64 bit platfrom using gcc 4.1.2. I have a utility function: void str_concat(char *buff, int buffSize, ...); which concats char * passed in variadic list(...), while last argument should be NULL, to designate end of the arguments. On 64 bit system NULL is 8 bytes. Now to the problem. My application includes di...

How to handle EINTR (interrupted System Call)

Hi, My user-space application sometimes blocks after receiving an EINTR-Signal, somehow. What I recorded with strace: time(NULL) = 1257343042 time(NULL) = 1257343042 rt_sigreturn(0xbff07be4) = -1 EINTR (Interrupted system call) --- SIGALRM (Alarm clock) @ 0 (0...