I have a complex drawing on a Gtk DrawingArea widget and I wish to provide the user with a way to select a rectangle on it to expand for a closer view. I have managed to get the necessary mouse button events sorted out so that the rectangle can be selected, but it would be desirable to have the actual rectangle drawn on the display, movi...
I'm currently writing a program that has debug output strewn throughout it. This is all well and good, but I'd like to be able to advance the tab position for things in different scopes, for instance, this is what I have right now:
#ifndef NDEBUG
printf("Updating player\n");
#endif
player.Update();
#ifndef NDEBUG
printf("Done updating p...
I'm pretty sure i'm the one who's just dumb and don't know my data structures...
None the less, i'm going to post it here for you brilliant guys, so one of you may explain to me why this doesn't work:
#include <iostream>
using namespace std;
double data_convert(int n);
int main(void) {
cout << data_convert(sizeof(int));
}
double...
E.g. when you hit the side of your monitor your cursor can't go any further, and more of an example is when in microsoft paint, and your choosing a colour from the RGB table, it won't allow your mouse to go outside of the rectangle while your mouse is down..
my question is how would you implement that in c++ with win32 api?
...
In my program I am trying to construct a filename with a path to point to a particular folder where my data is stored. I have something that looks like this:
string directoryPrefix = "C:\Input data\";
string baseFileName = "somefile.bin";
string fileName = directoryPrefix + index + " " + baseFileName;
However the compiler keeps saying...
Hello there - first post so apologies if I make some mistakes,
I am currently working through Accelerated C++ and have come across my first 'issue' in exercise 2-3.
A quick overview of the program - the program basically takes a name, then displays a greeting within a frame of asterisks - i.e. Hello ! surrounded framed by *'s.
The ex...
Hey,
I am writing on a small tcp chat server, but I am encountering some problems I can´t figure out how to solve "elegantly".
Below is the code for my main loop: it does:
1.Initiates a vector with the basic event, which is flagged, when a new tcp connection is made.
2. gets this connection and pushes it back into a vector, too. Then w...
Hi folks. Unfortunately I'm a complete novice when it comes to this kind of native windows programming. I have been tasked with attempting to figure this out within our group alas. Essentially I need an activex control to open a new browser window. In addition to this I would like to have a reference to the new windows hwnd when its done...
Hi SO,
I'm having trouble with dates management in C++ (VS 2008).
According to MSDN specifications, time_t represents:
The number of seconds since January 1, 1970, 0:00 UTC
therefore, I've written this piece of code:
#include <stdio.h>
#include <time.h>
time_t GetDate(int year, int month, int day, int hour, int min, int sec)
{
...
I have a long-running console-based application Sender that sends simple text to STDOUT using non-buffered output such as cout << "Message" << flush(). I want to create an MFC dialog-based application (named Receiver) that starts Sender and can read it's output. Receiver should also be able to detect when Sender has died, or be able to...
I have a long-running console-based application Sender that sends simple text to STDOUT using non-buffered output such as cout << "Message" << flush(). I want to create an MFC dialog-based application (named Receiver) that starts Sender and can read it's output. Receiver should also be able to detect when Sender has died, or be able to k...
Hi. I have this code.
char* cbuffer;
wchar_t* wbuffer;
cbuffer = _getcwd(NULL, 0);
wbuffer = _wgetcwd(NULL, 0);
Also, I have textbox1 and textbox2. How can I put cbuffer in textbox1 and wbuffer in textbox2. Thanks.
...
I sometimes read discussion on why C++ is good or bad and sometimes one of the arguments cites that today's modern C++ is very different from the old C++. I am wondering exactly what the difference would be? What would be an example of 'Modern' C++ and what would be an example (preferably doing the same thing) of this 'old' C++?
...
Hello. I'm wondering if there's an easy way to iterate through a fd_set? The reason I want to do this is to not having to loop through all connected sockets, since select() alters these fd_sets to only include the ones I'm interested about. I also know that using an implementation of a type that is not meant to be directly accessed is ge...
Possible Duplicate:
Why does C++ support memberwise assignment of arrays within structs, but not generally?
Why is it that we can assign the object of one structure to other directly
eg:
struct student s1,s2;
s2=s1 //is perfectly ok.
but we can not assign one array value to the other
eg:
int a[10],b[10];
a=b //is not all...
Hi, PTK is a 2d c++ framework for developing iphone apps on windows/mac. I followed the tutorial to set up a test app here: http://www.phelios.com/ptk/tuto1/
But I get the error
LNK1104: cannot open file 'dxguid.lib'
I am using Microsoft Visual C++ Express 2010
My Project Properties/Linker/Input/Additional Dependancies is this:
libptk...
I'm a little fuzzy on how variable access between .cpp files works. For instance:
main.cpp
int main()
{
int a = i;
return 0;
}
main2.cpp
int i;
This generates a compiler error on main.cpp, telling me there is no in i in existence. What difference then, does the "static" keyword do in this context? (I tried Googling for it,...
Simple problem, normally a program will produce a MessageBeep if the user presses Alt+Whatever and there's no hotkey associated with it. What API functions can I call to avoid this?
Handling WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, and WM_SYSKEYUP all with return 0; on my main WndProc does not work.
...
Look at this code:
#include <framework_i_hate.h>
int main() {
XFile file("./my_file.xxxx", "create");
XObject object("my_object");
// modify the object
object.Write();
}
Try to guess where object will be saved... yes, you guessed it. I think this is too magic, I'd like to write something like object.Save(file), but it's not n...
Possible Duplicates:
References Needed for Implementing an Interpreter in C/C++
Books On Creating Interpreted Languages
How to create a language these days?
Learning to write a compiler
Possible Duplicate:
Learning to write a compiler
Ok so I'm only 13 years old. I know some c++, VERY good at php, pro at css h...