I just started off with OpenMP using C++. My serial code in C++ looks something like this:
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <fstream>
#include <stdlib.h>
int main(int argc, char* argv[]) {
string line;
std::ifstream inputfile(argv[1]);
if(inputfile.is_open()) {
whi...
I have written a text editor program in C++ that has simple commands: LEFT, RIGHT, HOME, END, BACKSPACE, DELETE, INSERT, and now I need to perform the UNDO and REDO functions. In my program the user must be able to undo no more than the last ten commands. I would like to use a vector implementation to accomplish this, but I have no ide...
Hey all,
First of all, as usual, thanks to all for the great support from the SO community.
So I wrote code to draw 6 gl_quads (to form a cube). Initially, this code was drawn immediately (explicitly made 24 vertex calls in the display function). I'd like to put these in a display list. I read a tutorial about display lists, and gav...
This has actually occurred twice now. I'm writing a cross-platform application, and some of my function names conflict with the Windows API. What I did (for example with LoadObject) was...
#undef GetObject
Is this an okay approach, or should I rename my functions?
...
I'm using QImage.save to save an image of my OpenGL framebuffer to disk. If I just call save("plot.jpg"), I have no idea where the image ends up. It's not in the application directory. I can call save("/Users/wallacer/desktop/plot.jpg") to save the file on my desktop, but obviously that's no good for running on anyone else's machine. ...
I'm new to maps. I need a class that constructs seating for a performance (there are many performances). Here's what I have so far:
// header stuff/libraries
Seats::Seats()
{
map< const string, bool > seat;
seat["A1"] = false;
seat["A2"] = false;
/* more seats .. */
}
Do I need to create an access member if I want to...
The target platform is Windows. Sought-after languages: C++ (Native as well as CLI), C#. Java examples are al right as well.
I am not too worried about security, but I am curios about the language agnostic design aspect of this as well - what is a good way to deliver a crash report?
Something that I am looking for - code that can gathe...
What is the most interesting or difficult question asked to you during an C++/OOD interview?
What is the most interesting or difficult question you like to ask to a candidate during a C++/OOD interview?
Edit: Updated the misleading Title
Edit: Ofcourse:
1. When you are the one being interviewed.
2. When you are intervieweing so...
Consider this somewhat of a follow up to this question. Essentially, the C++ date/time formatting facilities seem to be hopelessly broken - so much so that in order to do something as simple as convert a date/time string into an object, you really have to resort to either Boost.Datetime or good old C strftime/strptime facilities.
The...
I am currently trying to make the move from C# and break free from my platform boundaries by using Qt / C++.
I was using TagLibSharp in my old project, but I'm now trying to use the original C++ source found here:
http://developer.kde.org/~wheeler/taglib.html
I am in a world of hurt trying to compile this into my application. Most of ...
I am working on a web browser with c++ using IWebBrowser2. Declared on the top, outside any scope, I have this:
static char buf[1024];
In the documentcomplete event, I set the BSTR with:
CComBSTR bstrHTMLText;
X->get_outerHTML(&bstrHTMLText);
What I want to do is to copy bstrHTMLText value into buf (if bstrHTMLText length is > 1024...
If I'm going to do this kinda operation many times:
res = mysql_perform_query(conn, "show tables");
printf("MySQL Tables in mysql database:\n");
while ((row = mysql_fetch_row(res)) !=NULL)
printf("%s\n", row[0]);
Do I need to run mysql_free_result(res); at the end of each operation or rely on garbage collection mechanism ...
What is wrong with the following code? How come it does not found the letter using my implementation of a binary search?
#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>
#include <cwctype>
using namespace std;
bool contains(string s, char a){
int m = 0;
int n = s.length()-1;
while (m != n) {
int k...
Hi all,
I'm trying to set up 3D sounds with FMOD in a game which uses Ogre. The sound listener is attached to the camera which runs on a spline. I have footstep sounds attached to the player, and the volume should be determined by how far the player is from the camera.
The foot step sounds are acting as though the sound listener is no...
printf("%s\n", multibytestring);
By default the multi-byte characters will show up like ??? in console, how can I fix it?
...
What free tools could I use to test the performance of C++ code in Linux? Basically I want to identify the bottleneck of the code and improve on the performance. My application mainly involves computational code using the data from the network. So I would like to improve the speed of execution of the code.
Thanks.
...
I have an application that is using a cross platform library developed internally.
For various reasons I must stick with using this library under windows at least.
That library contains a socket class that I have to use and it's calling select.
I have the ability to modify the library a little.
Would there be a performance improvement ...
Hi everyone.
I'm about to write an simple plugin for Total Commander. I need to interact with Picasa service. I goggled for a while and found:
1) gdata-cpp-util (kind of a wrapper for libcurl and libxml)
http://code.google.com/p/gdata-cpp-util/
2) use gdata-java-client for Google Data transmitting and interact with c++ code via JNI
ht...
Hi, I have this:
typedef enum{
Adjust_mode_None = 0,
Adjust_mode_H_min,
Adjust_mode_H_max,
Adjust_mode_S_min,
Adjust_mode_S_max,
Adjust_mode_V_min,
Adjust_mode_V_max
}Adjust_mode;
and at some point I want to do:
adjust_mode_ = (adjust_mode_+1)%7;
but I get Invalid conversion from int to Adjust_mode
This is ok in other lan...
I have following code:
#include <vector>
using namespace std;
struct Point
{
int x, y;
};
bool Sort(struct Point& a,struct Point& b){
return a.x<b.x;
}
int main(int argc, char *argv[])
{
vector<Point>a;
for (int i=0;i<10;i++){
cin>>a[i].x>>a[i].y;
}
sort(a,10,Sort);
system("PAUSE");
return EXIT_SUCCESS;
}
but it s...