c++

how to break into code when a file has been touched

I inherited an application using a large number of texts based files for configuration. The file's names are constructed dynamically in the software, so I can't search directly for a file name if the source code. Is there any way to break into a program running in the debugger when it touches a particular text file ? ...

HOW to use OpenSSL in C to send email (via gmail) using SMPTS (TLS)

Writing in C/C++ (not COM C#) As a follow on from these questions: http://www.developerweb.net/forum/showthread.php?t=3477 http://stackoverflow.com/questions/440762/openssl-command-line-troubles http://stackoverflow.com/questions/1246742/how-to-translate-openssl-sclient-starttls-smtp-command-to-c-code http://stackoverflow.com/questio...

Inserting into an Array Based Binary Search Tree? C++

Hello. Im trying to insert into an array Based Binary Search tree. I am not sure how i prevent overwriting data using left and right indexes... Do i insert leftchild as tree[2 * i + 1] and rightchild as tree[2 * i + 2] ? I think it is for locating the position of a node given its name... Thats my problem. Not knowing how to insert, ...

Concatenating strings in macros - C++

What's the easiest way to concatenate strings defined in macros. i.e. The pseudo code I'm looking for would be like: #define ROOT_PATH "/home/david/" #define INPUT_FILE_A ROOT_PATH+"data/inputA.bin" #define INPUT_FILE_B ROOT_PATH+"data/inputB.bin" ... #define INPUT_FILE_Z ROOT_PATH+"data/inputZ.bin" The only way I know of is to use st...

Print text into a Windows input text box

Background I'm trying to write an application in C++ that will run on Vista. The application will take input from a the user (via input text box), perform some manipulation of that text, and will direct the user to click on an input box in another application. I'd like my application to print text into the second application's text box. ...

Any likely causes of a double-free in ncurses?

I have an ncurses app that does the following, sometimes instantly after launch, sometimes after some fiddling. malloc: *** error for object 0x100300400: double free Program received signal SIGABRT, Aborted (gdb) where #0 0x00007fff846a7426 in read () #1 0x00007fff83f3d775 in _nc_wgetch () #2 0x00007fff83f3de3f in wgetch () (and so on i...

How does one properly use the Unix exec C(++)-command?

Specifically, I need to call a version of exec that maintains the current working directory and sends standard out to the same terminal as the program calling exec. I also have a vector of string arguments I need to pass somehow, and I'm wondering how I would go about doing all of this. I've been told that all of this is possible exclusi...

How to use QueryPerformanceCounter?

I recently decided that I needed to change from using milliseconds to microseconds for my Timer class, and after some research I've decided that QueryPerformanceCounter is probably my safest best. (The warning on Boost::Posix that it may not works on Win32 API put me off a bit). However, I'm not really sure how to implement it. What I'...

Does C++ have standard libraries for common File Utilities

Hi all, I am looking for standard libraries in C++ that would allow me to do things like: Traverse a directory recursively search for files within a directory Check if file exists, folder exists or not and create it if not present. Check a folder hierarchy exists or create it if not found. Equivalent of mkdir -p Uncompressing / Compre...

What is the difference between Go's multithreading and pthread or Java Threads?

What is the difference between Go's multithreading approach and other approaches, such as pthread, boost::thread or Java Threads? ...

Easier way to find (visual) position of QModelIndex in QTreeView...

Greetings, I'm interested in calculating the physical position of a node in QTreeView and can't find a way to do this (other than calculating it myself, which is cumbersome and error prone given the robustness of QTreeView). Is there a standard way of finding the draw position of data associated with a QModelIndex (something similar to...

C++ Classes - Pointers question

I had a quiz at school and there was this question that I wasn't sure if I answered correctly. I could not find the answer in the book so I just wanted to ask you. Point* array[10]; How many instances of class Point are created when the above code is called? I answered none because it only creates space for 10 instances, but doesn't ...

Can someone help me with an array based Binary Search Tree C++?

This what i have so far. void BST::insert(const data& aData) { if ( items[root_index].empty ) { items[root_index].theData = aData;// Get the data. items[root_index].empty = false; oldRoot.theData = aData; } else { if ( aData < items[root_index].theData ) { leftChild = root_index *...

Help debug this problem

I've probably included more than I needed to, but then again, I probably missed exactly what I needed to add. At any rate, below is a stack trace, some valgrind output, and some related code. The valgrind output probably explains most. I don't think the stack trace is worth much; maybe the program output right before it might be useful. ...

Custom C++ manipulator problem

Hi guys, I'm trying to implement my own stream manipulator inside my logging class. It's basically endline manipulator which changes state of a flag. However when I try to use it, I'll get: ftypes.cpp:57: error: no match for ‘operator<<’ in ‘log->Log::debug() << log->Log::endl’ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/...

Unable to use SetTransform in D3D9

What might stop IDirect3DDevice9::SetTransform from working? I've looked at alot of tutorials for using transformation matrices in Direct3D9, including this one here. And as far as I can tell, they all do it the same way. I'm trying to write some code just to translate a texured polygon. I call SetTransform with a matrix initialized wit...

getaddrinfo() returning only ::1 as IPV6 address,

I'm using getaddrinfo() to return all assigned IP addresses (both IPv4 and IPv6) for my local machine. I see that on XP, getaddrinfo() only returns ::1 ( I installed the IPV6 stack on 2 XP machine and configured the IPV6 address and pinged the both peers. they are working fine. I check the Ipconfig its all working fine. ) ...

Help me understand and fix this algorithm

I wrote the following, but I'm not understanding it after modifying it some to fit with single pixels (graphic displays) instead of single characters (character displays). XRES x YRES is the pixel resolution of each character. LCDGraphic draws its own characters based on these values. The idea in this transition algorithm is that you ca...

Programmatically parse and edit C++ Source Files

Hi, I want to able programmatically parse and edit C++ source files. I need to be able to change/add code in certain sections of code (i.e. in functions, class blocks, etc). I would also (preferably) be able to get comments as well. Part of what I want to do can be explained by the following piece of code: CPlusPlusSourceParser cp = n...

String concatenation query c++

#include <stdio.h> #include <string.h> #include <conio.h> #include <iostream> using namespace std; char a[21]; // If this is put inside the function unter -> junk output char* b=""; void unter() { char *new_str = ""; strcpy(a, new_str); char str_temp[10]=""; int chnum =0, neighbor1=3, neighbor2=...