c++

What am i doing wrong

I have the following code. I need B class to have a min priority queue of AToTime objects. AToTime have operator>, and yet i receive error telling me than there is no operator> matching the operands... #include <queue> #include <functional> using namespace std; class B{ //public functions public: B(); virtual ~B(); //priva...

file doesn't open, running outside of debugger results in seg fault (c++)

Hello (and thanks in advance) I'm in a bit of a quandry, I cant seem to figure out why I'm seg faulting. A couple of notes: It's for a course -- and sadly I am required to use use C-strings instead of std::string. Please dont fix my code (I wont learn that way and I will keep bugging you). please just point out the flaws in my ...

C++0x - export gone, exception specs deprecated. Will this affect your code?

This latest Herb Sutter trip report on the C++0x standardisation process indicates that the committee has decided to completely drop the "export" concept for templates, and to deprecate exception specifications. I think these are both good moves, but I'm interested if anyone out there has a code base where these changes will cause them...

Are there any lint tools for C and C++ that check formatting?

I have a codebase that is touched by many people. While most people make an effort to keep the code nicely formatted (e.g. consistent indentation and use of braces), some don't, and even those that do can't always do it because we all use different editors, so settings like spaces vs. tabs are different. Is there any standard lint tool...

Convert GUI C++ app to a console one

I have a GUI C++ application (Visual Studio 2008) that needs to be converted to a console one. I don't have any experience in C programming. Mostly I use .NET. Where do I start? ...

How programmable detect if a user has admin rights (can run installer)

Hi in my code I need to detect if current user has rights to install other application (other application VC2005 redist. package)... and it should work on Vista. As I understand CheckTokenMembership or IsAdministrator do not give a complete solution. Thank you ...

Do c++ templates make programs slow ?

Hi, I have heard from many people that usage of templates make the code slow. Is it really true. I'm currently building a library. There are places where if templates are not created, it would result in code management problem. As of now I can think two solutions to this problem: use #defines Use templates and define all possible t...

Looking for a better way to integrate a static list into a set of classes

I'm trying to expand my sons interest from Warcraft 3 programming into C++ to broaden his horizons to a degree. We are planning on porting a little game that he wrote. The context goes something like this. There are Ships and Missiles, for which Ships will use Missiles and interact with them A Container exists which will hold 'a list...

Useful videos in YouTube for learning programming

Is it possible to really find useful tutorials and videos for learning programming languages in YouTube? Could you recommend some channels? I would like to learn about: Vim, Apache Subversion, and C++. ...

Split text by whitespaces

Hi to all. I have text file with some text information and i need to split this text at spaces and all word push into List. I make so: QStringList list = line.split(" "); for (int i = 0; i < list.count(); i++){ table.push_back(list[i]); this->ui->textEdit->setText(list[i]); } In line i have my text. But when i test...

How to retreive SID's byte array

Hello experts, How can I convert a PSID type into a byte array that contains the byte value of the SID? Something like: PSID pSid; byte sidBytes[68];//Max. length of SID in bytes is 68 if(GetAccountSid( NULL, // default lookup logic AccountName,// account to obtain SID &pSid // buffer to allocate to...

Catching a nested-in-template exception [C++]

Hello, I have a problem with writing a catch clause for an exception that is a class nested in a template. To be more specific, I have a following definition of the template and exception: /** Generic stack implementation. Accepts std::list, std::deque and std::vector as inner container. */ template < typename T, template ...

C/C++ function definitions without assembly

Hi, I always thought that functions like printf() are in the last step defined using inline assembly. That deep into stdio.h is burried some asm code that actually tells CPU what to do. Something like in dos, first mov bagining of the string to some memory location or register and than call some int. But since x64 version of Visual Studi...

Is there a way to get the PREMATCH ($`) and POSTMATCH ($') from pcrecpp?

Is there a way to obtain the C++ equivalent of Perl's PREMATCH ($`) and POSTMATCH ($') from pcrecpp? I would be happy with a string, a char *, or pairs indices/startpos+length that point at this. StringPiece seems like it might accomplish part of this, but I'm not certain how to get it. in perl: $_ = "Hello world"; if (/lo\s/) { $...

Interaction between C++ and Rails applications

I have two applications: c++ service and a RoR web server (they are both running at same VPS) I need to "send" some variables (and then do something with them) from each other. For exaple, i'm looking for something like this: // my C++ sample void SendMessage(string message) { SendTo("127.0.0.1", message); } void GetMessage(string ...

c/c++ how to convert short to char

Hi I am using ms c++. I am using struct like struct header { unsigned port : 16; unsigned destport : 16; unsigned not_used : 7; unsigned packet_length : 9; }; struct header HR; here this value of header i need to put in separate char array. i did memcpy(&REQUEST[0], &HR, sizeof(H...

MATLAB arbitrary code execution

I am writing an automatic grader program under linux. There are several graders written in MATLAB, so I want to tie them all together and let students run a program to do an assignment, and have them choose the assignment. I am using a C++ main program, which then has mcc-compiled MATLAB libraries linked to it. Specifically, my progra...

How do I find where an exception was thrown in C++?

I have a program that throws an uncaught exception somewhere. All I get is a report of an exception being thrown, and no information as to where it was thrown. It seems illogical for a program compiled to contain debug symbols not to notify me of where in my code an exception was generated. Is there any way to tell where my exceptions ...

Has the small object allocator found in "Modern C++ Design"/Loki been deprecated in favor of newer implementations?

It seems the code and the book have been relegated to the foundation of the movement of modern C++, and isn't updated any more. Is there some kind of replacement for this in Boost or TR1? ...

C Language - \n - creating virus

#include<stdio.h> #include<conio.h> union abc { int a; int x; float g; }; struct pqr { int a; int x; float g; } ; void main() { union abc b; struct pqr c; clrscr(); b.a=10; textbackground(2); textcolor(6); cprintf(" A = %d",b.a); printf("\nUnion = %d",sizeof(b)); printf("\nStructure = %d",sizeof(c)); get...