I'm having this problem for quite a long time - I have fixed sized 2D array as a class member.
class myClass
{
public:
void getpointeM(...??????...);
double * retpointM();
private:
double M[3][3];
};
int main()
{
myClass moo;
double *A[3][3];
moo.getpointM( A ); ???
A = moo.retpointM(); ???
...
I am trying to setup allegro to work with visual stupid express 2008 but I can't find a set of instructions for the life of me. I just want to to recognize the allegro library. Is there anyone who is familuar with allegro who could possibly help me out cause all the tutorials do not cover installation process and their documentation is ...
I am following a tutorial and one of the steps its asking is to go to my projects properties and click on c/c++ and add a path to "Additional Include Directories" property. I am using visual C++ Express Edition 2008. the tutorial is using the same thing. Is there away to get this or an alternative ??
This is my screen
This is tutorial...
Hi all,
I have to make a project to run successfully on a Linux machine. Right now my project works very well on windows machine. On Windows machine it is compiling and working fine. My project is using one ".lib" and one ".dll" file to do the tasks successfully on Windows. Can i use the same .lib file and .dll file on linux machine to...
#include <iostream>
using namespace std;
int main ()
{
double testscore;
cout << " Enter your test score and i will tell you the letter grade you earned ";
cin >> testscore;
switch (testscore)
{
case (testscore < 60.0):
cout << "your grade is F.\n";
break;
default:
...
I am currently studying COM and the following code confused me.
STDMETHODIMP _(ULONG) ComCar::Release()
{
if(--m_refCount==0)
delete this; // how could this "suicide" deletion be possible?
return m_refCount;
}
I am wondering how could it be possible to delete an object instance within its member method? So I made the following...
Hello friends,,I am creating a file in which I will have some details in it...I dont any body to edit it..so I decided to keep that as read only file...I tried the following code but its popping an exception when I am setting the status...Please tel me if there are any alternative
CFile test(L"C:\\Desktop\\myText.txt",CFile::modeCreate|...
I'm porting a C++ program to Python. There are some places where it uses std::set to store objects that define their own comparison operators. Since the Python standard library has no equivalent of std::set (a sorted key-value mapping data structure) I tried using a normal dictionary and then sorting it when iterating, like this:
def __...
I have a file:
P 0.5 0.6 0.3
30 300
80 150
160 400
200 150
250 300
T
r 45 0 0
s 0.5 1.5 0 0
t 200 –150
.
.
.
When I read in 'P' I know that 3 floats will follow. That will be followed by a finite number of X and Y coordinates. The number will vary until a 'T' is reached which I have to recognize. Then there could be an 'r', 's' or 't...
Suppose I have a class named A:
Class A
{
...
}
And what's the difference between the following 2 approaches to instanciate an object:
void main(void)
{
A a; // 1
A *pa=new A(); // 2
}
As my current understanding (not sure about this yet):
Approach 1 allocate the object a on the stack frame of the main() method, and so ...
Years ago I had a little #define which I used in Borland C++ Builder. From memory, it was something approximately like
#define BREAK_IF_DEBUGGING asm(0xA3);
or something like that. It relied on 0XA3 (or whatever it was) being the op code for the interrupt which Borland were using to trigger a breakpoint.
Can I do the same thing in...
I've written tons of operator<<(std::ostream &, const T &) functions -- they're incredibly useful.
I've never written an operator>>(std::istream &, T &) function in real code or even used the extraction operators for built-in types (OK, maybe for std::string). Are these appropriate only for short example programs and textbooks? Is ope...
How can I draw text (with setting font and size) on image and save it as JPEG?
For example
CBitmap bitmap;
bitmap.CreateBitmap(width, height, 1, 32, rgbData);
Here I want to draw some text on bitmap:
CImage image;
image.Attach(bitmap);
image.Save(_T("C:\\test.bmp"), Gdiplus::ImageFormatJPEG);
...
Hey folks,
I am currently writing a program in c++ (no MFC) and want to update a label (win32 static control) using the win32 DrawText function. However when i call the function nothing is written to the label. I use the following code:
HDC devCon = ::GetDC(GetDlgItem(IDC_TITLE).m_hWnd);
RECT rect = {10, 10, 100, 15};
::Dra...
I have a class "foo" that has a multi dimensional array and need to provide a copy of the array through a getArray member. Is there a nice way of doing this when the array is dynamically created so I can not pass the array back a const as the array is always being deleted, recreated etc. I thought about creating a new dynamic array to pa...
I have a piece of code that can read current state of serial port CTS line, and application then goes into appropriate mode bases on value there.
Using null-modem cable described here:
http://www.lammertbies.nl/comm/info/RS-232_null_modem.html#full
i can detect RTS line on some other port that is connected via that null-modem cable.
...
I've written some code in c++ using a CScrollbar which scrolls a CWnd and treeview at the same time. This works perfectly find on my pc, but on other pc's in the office it has problems:
it only scrolls up
it allows the user to scroll when they don't need to
I've tested this on Vista, XP, and Windows 7 and they all have the same resul...
I have used unions earlier comfortably; today I was alarmed when I read this post and came to know that this code
union ARGB
{
uint32_t colour;
struct componentsTag
{
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t a;
} components;
} pixel;
pixel.colour = 0xff040201;
/* ---- somewhere down the...
I made two console app: Broadcasting listener and UDP writer (for practice only). Each run on different machine over the internet.
Broadcasting listener:
INADDR_ANY, port 5555
Udp writer:
Enabled Broadcasting (setsockopt, SO_BROADCAST)
Case:
The writer send some datagrams to listener server (ip: 113.169.123.138). Listener can r...
I want to find an element in the map using map::find(key), and then iterate the map in reverse order from the point where I found the element, till the beginning (i.e. until map::rend()).
However, I get a compile error when I try to assign my iterator to a reverse_iterator. How do I solve this?
...