Hello,
I am using borland 2006 c++, and have following code. I am using vectors, and have trouble understanding why the destructor is not being called.
basically i have a class A
class A
{
private:
TObjectList* list;
int myid;
public:
__fastcall A(int);
__fastcall ~A();
};
__fastcall A::A(int num)
{
myid = num;
list...
Hi,
For my project i needed to rotate a rectangle. I thought, that would be easy but i'm getting an unpredictable behavior when running it..
Here is the code:
glPushMatrix();
glRotatef(30.0f, 0.0f, 0.0f, 1.0f);
glTranslatef(vec_vehicle_position_.x, vec_vehicle_position_.y, 0);
glEnable(GL_TEXTURE_2D);
glEnable(GL_B...
I'm consistently running into an internal compiler error while attempting to switch from MSVC6 to MSVC 2008. After much work commenting out different parts of the program, I've traced the error to two lines of code in two different CPP files. Both of these CPP files compile successfully, yet somehow have an effect on whether or not the...
Hey there,
is there any recommendation for a library (c++, Win32, open source) to get the sound from a microphone?
Thanks
...
I'm trying to use setuid() and setgid() to set the respective id's of a program to drop privileges down from root, but to use them I need to know the uid and gid of the user I want to change to.
Is there a system call to do this? I don't want to hardcode it or parse from /etc/passwd .
Also I'd like to do this programatically rather tha...
In C++, one way to get late/dynamic binding is to use function pointers we can also use virtual functions.
But don't know about the early/static binding.
...
Hello ,
Iam using borland 2006 c++
class A
{
private:
TObjectList* list;
int myid;
public:
__fastcall A(int);
__fastcall ~A();
};
__fastcall A::A(int num)
{
myid = num;
list = new TObjectList();
}
__fastcall A::~A()
{
}
int main(int argc, char* argv[])
{
myfunc();
return 0;
}
void myfunc()
{
vector<A> vec;...
I'm using Microsoft Visual Studio 2008 with a Windows target deployment. How would I make a file "update itself"? I've already got the "transmitting over a network" part down, but how do I make an executable write over itself?
Basically, I want to write an auto-updater for a directory that also includes the auto-updater, and the updater...
A comment to http://stackoverflow.com/questions/945232/whats-wrong-with-this-fix-for-double-checked-locking says:
The issue is that the variable may be
assigned before the constructor is run
(or completes), not before the object
is allocated.
Let us consider code:
A *a;
void Test()
{
a = new A;
}
To allow for more for...
For example, if I have the following:
void foo(string* s)
{
bar(s); // this line fails to compile, invalid init. error
}
void bar(const string& cs)
{
// stuff happens here
}
What conversions do I need to make to have the call the bar succeed?
...
Anyone know of an eye-tracking library for C#, C/C++ or Objective-C? Open-source is preferable. Thanks.
...
I am debugging a (native) multi-threaded C++ application under VS2008. On seemingly random occasions, I get a "Windows has triggered a break point..." error with a note that this might be due to a corruption in the heap.
These errors won't always crash the application right away, although it is likely to crash short after.
The big probl...
I know that I can create an integer variable for a group of radio buttons, set it to an integer, and then call UpdateData(FALSE) to make the window highlight the appropriate radio button control. However, I would like to perhaps use a CButton control instead, but I don't know how to set the CButton state so that a particular radio button...
I'm looking for a clean way of doing this since a long time. In my problem, there exist 3 classes not sharing any parent in common but each having some methods with the same name (A.doSomething, B.doSomething, C.doSomething). Hence, having the same function signature, class D inheriting from A and using method doSomething() will "look th...
I was wondering if it is possible to change the return type of a function based on the type of variable it is being assigned to. Here's a quick example of what I mean.
I want to create a function that parses a variable of int, bool, or float from a string. For example...
Int value = parse("37");
Float value = parse("3.14");
Bool value ...
SOCKET client = accept(listen_sock, 0, 0);
timeval client_to;
client_to.tv_sec = 1;
client_to.tv_usec = 0;
setsockopt(client, SOL_SOCKET, SO_RCVTIMEO, (char*)&client_to, sizeof(client_to));
char buffer[1024];
while ((ret = recv(client, buffer, 1024, 0)) != 0)
{
cout << "<in loop>" << endl;
if (ret == -1 && WSAGetLastErr...
I am trying to convert a C++ std::string to UTF-8 or std::wstring without losing information (consider a string that contains non-ASCII characters).
According to http://forums.sun.com/thread.jspa?threadID=486770&forumID=31:
If the std::string has non-ASCII characters, you must provide a function that converts from your encoding ...
Hi,
I want to hash a char array in to an int or a long. The resulting value has to adhere to a given precision value.
The function I've been using is given below:
int GetHash(const char* zKey, int iPrecision /*= 6*/)
{
/////FROM : http://courses.cs.vt.edu/~cs2604/spring02/Projects/4/elfhash.cpp
unsigned long h = 0;
...
I am facing a problem and unable to resolve it. Need help from gurus. Here is sample code:-
float f=0.01f;
printf("%f",f);
if we check value in variable during debugging f contains '0.0099999998' value and output of printf is 0.010000.
a. Is there any way that we may force the compiler to assign same values to variable of float ty...
while programming in c++,
Most of the times i get 'some symbol' has already been defined
see previous definition of 'some symbol'
I think this happens because improper order of headers file included.
How can i find out all the definitions of 'some symbol'
Thanks in advance,
Uday
EDIT:
I am using visual studio
I remember some comma...