c++

Is a display list best for this? (OpenGL)

I'm rendering 2D polygons with the GLUTesselator the first time, then they are stored in a display list for subsequent use. I think VBO's might be faster, but since I can't access the stuff that the tesselator outputs, and since it uses mixes of gl_triangle, quad, strip etc, i'm not sure how I could do this, even though I would like to u...

Agilent E4426B signal generator locks up during multiple GPIB *SAV operations

I have a test fixture with an Agilent E4426B RF signal generator connected to a PC via a National Instrument Ethernet-to-GPIB bridge. My software is attempting to sanitize the instrument by presetting it and then saving the current state to all of the memory locations writable via the standard SCPI command "*SAV x,y". The loop works to...

Exclude subexpression from regex in c++

Suppose I was trying to match the following expression using regex.h in C++, and trying to obtain the subexpressions contained: /^((1|2)|3) (1|2)$/ Suppose it were matched against the string "3 1", the subexpressions would be: "3 1" "3" "1" If, instead it were matched against the string "2 1", the subexpressions would be: "2 1" "2...

how can i develop a command prompt based line editor utility ?.

so user will be able to edit/modify/view the content of the actual physical file. command like open, show, append, delete,swap,move,close,exit should be work on that command line. ...

Is it good practice to use assert() in class mutators?

For example: void Date::month(unsigned int inMonth) { assert(inMonth <= 12); _month = inMonth; } If this is not good practice, what is the correct way to go about this? ...

C++: How would I get unix time?

I need a function or way to get the UNIX epoch in seconds, much like how I can in PHP using the time function. I can't find any method except the time() in ctime which seems to only output a formatted date, or the clock() function which has seconds but seems to always be a multiple of 1 million, nothing with any resolution. I wish to ...

error C2440: '=' : cannot convert from 'std::string []' to 'std::string []'

now what is wrong with this code! Header: #pragma once #include <string> using namespace std; class Menu { public: Menu(string []); ~Menu(void); }; Implementation: #include "Menu.h" string _choices[]; Menu::Menu(string items[]) { _choices = items; } Menu::~Menu(void) { } compiler is complaining: error C2440: '=' ...

Looking for production quality Hash table/ unordered map implementation to learn?

Looking for good source code either in C or C++ or Python to understand how a hash function is implemented and also how a hash table is implemented using it. Very good material on how hash fn and hash table implementation works. Thanks in advance. ...

Bitwise operators and converting an int to 2 bytes and back again.

first time user, Hi guys! So hopefully someone can help.. My background is php so entering the word of lowend stuff like, char is bytes, which are bits.. which is binary values.. etc is taking some time to get the hang of ;) What im trying to do here is sent some values from an Ardunio board to openFrameWorks (both are c++). What this...

if i need oparete small web server in my application ,does it recognase as virus?

Hello all i need to operate smell web server in my application play flash swf files in my embedded browser , this application will be distributed to local users to desktop users what is the best way to implement it in desktop application i mean ports / local host ? ...

error: typedef name may not be a nested-name-specifier

I am trying to do something along the lines of this answer, and struggling: $ gcc --version gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4) file.cpp:7: error: template argument 1 is invalid file.cpp:7: error: typedef name may not be a nested-name-specifier And the offending part of the file: template <class R, class C, class T0=void, cl...

Way Cross Compile C/C++ code to run on Windows, Linux, and Mac OS?

Is there a way to take my C++ code and cross compile it to run on Windows, Mac OS, and Linux? Is there a tool to do this, or does it have to be manually compiled on each OS via Terminal/Cygwin? ...

Call C methods from C++/Java/C# code?

Many of today's programming languages are based on C; like C++, C#, Java, Objective-C. So could I call a C method from C++ code? Or call C from Java or C#? Or is this goal out of reach and unreasonable? Please include a quick code sample for my and everyone else's understanding. ...

Read number from text file using C++ stream

Hi all I have a text file like below 2 1 2 5 10 13 11 12 14 2 0 1 2 99 2 200 2 1 5 5 1 2 3 4 5 1 0 0 0 I want to read file line by line, and read the umbers from each line. I know how to use the stream to read a fixed field line, but what about the non-fixed line? Best Regards, ...

Statically initialize anonymous union in C++

I am trying to statically initialize the following structure in Visual Studio 2010: struct Data { int x; union { const Data* data; struct {int x; int y; }; }; }; The following is fails with error C2440: 'initializing' : cannot convert from 'Data *' to 'char'. static Data d1; static Data d = {1, &d1}; static Da...

Stupid Question Regarding If-Else's Simultaneous Execution in C++ or C

In C or C++ if ( x ) statement1; else statement 2; for what value of x both statements will be executed?? I know we can execute if-else together like this: if(1){ goto ELSE; } else{ ELSE: } Is there any way, like a value? (Which i think is not possible. Asking because someone is arguing!) ...

In c++ is there any Events/delegates/interfaces/notifications! anything?

Say i have these classes ViewA and ViewB In objective C using the delegate pattern I could do @protocol ViewBDelegate{ - (void) doSomething(); } then in ViewB interface: id<ViewBDelegate> delegate; then in ViewA implementation i set the delegate: viewB.delegate = self; and now I can call in doSomething from viewB onto any tha...

Simple binary File I/O problem with cstdio(c++)

The c++ program below fails to read the file. I know using cstdio is not good practice but that what I am used to and it should work anyway. $ ls -l l.uyvy -rw-r--r-- 1 atilla atilla 614400 2010-04-24 18:11 l.uyvy $ ./a.out l.uyvy Read 0 bytes out of 614400, possibly wrong file code: #include<cstdio> int main(int argc, char* argv[...

I wanna make a UDP comunication between two or more computers using c++ on linux

Hi every one! I really need to make this connection throw wireless (or lan ethernet). I have done this on windows (VS2008 C#, sockets), but here on linux (ubuntu 10.04) I have installed mono, and i can handle many things there, but it's speed is unacceptable for my 600MHz processor. so i decided to move on c++, but i'm new to c++ and i'm...

How to open GDI+ Bitmap in readonly mode?

I want to open a image(jpeg, bmp) using GDI+ using readonly mode, in c++。How can I do this? Many Thanks! ...