I have a project that I am trying to fix from a guy that left (let go) from my company. He has violated every fundamental principle of software engineering, not using source control, not backing up the source before you make more changes, etc. etc.
I need to make changes to an application that is in the field and I don't have the origi...
Hi,
I wanna write a simple RSS Feed reader in C++.
I understand that the basic requirement is to understand XML parsing ( at the low level), opening, reading/writing, closing sockets and stuff like that. I don't need help in coding for sure. But It would be great if someone can help in getting started with RSS Protocol. E.g.. How exactl...
hello to everyone, I'm reading the book of Meyers about effective c++ programming, in item 25 I found total template specialization, but I can't understand it, what does that it mean? he also gives example:
namespace std {
template<>
void swap<Widget>(Widget& a, Widget& b)
{
swap(a.pimpl, b.pimpl);
}
...
Is it possibile to ignore punctuacion using std manipulator on cin? For example suppose you have an input stream (in the actual case a file) like: "one, two three". I want to be able to do:
f >> ignore_punct >> a;
f >> ignore_punct >> b;
f >> ignore_punct >> c;
at the end a=="one", b=="two", c=="three".
...
I am trying to write a c++ program that creates a child process, runs a command and pipes the output back to the input of a command the parent is running.
I have the parent execute the wait(NULL) or wait((void*)pid) command but it does not wait.
here is the code:
#include <string.h>
#include <fstream>
#include <iostream>
#include <uni...
How many different ways are there to define constants in C or C++?
I am already aware of using the const keyword and the #define directive. I heard somewhere that there are two more ways to define constants, but I've never seen any others.
Are there any others?
...
I want to do something like this:
I want the user to provide a return type and an argument (there will always only be one) then I want the user to be able to provide the pointer of a function that matches this criteria. I will be using this to create a timed event.
The issue here is that usually with templates you must provide T and make...
I noticed that boost does not seem to support semaphores. What's the easiest way to achieve a similar effect?
...
Can someone please tell what is the code for checking the size of a linked list(number of nodes).This is what my code is(inserting nd deleting head + printing info of all nodes)
struct node
{
int info;
node *nextptr;
};
class list
{
private:
node *L,*tail;
int count;
public:
list()
{
L=tail=NULL;
...
I have implemented a basic threaded producer-consumer (thread 1 = producer, thread 2 = consumer) using Boost threads and conditions. I am getting stuck in wait() indefinitely quite often. I can't really see what could be wrong here. Below is some pseudo-code:
// main class
class Main {
public:
void AddToQueue(...someData...)
{
b...
Is there a way to output to an excel file but to assign what you're outputting to a specific cell in the excel file?
For example have an array be cell x 1-50 or something like this.
...
Relevant portion of the .h file:
template<class T, class W>
T inputValidate( T input, W minVal, W maxVal);
Relevant portion of the .cpp file:
T inputValidate( T input, W minVal, W maxVal)
{
if (input < minVal || input > maxVal)
{
cout << "Invalid input! Try again: ";
cin input;
}
return input;
}
I get an error of "er...
I have successfully piped the output of one command into the input of another and then show the output of the second command to the screen.
I want to do this with three successive commands. (actually eventually I want to do it with N commands passed into the program at run time.
This is my attempt at pipelining three commands together....
In http://stackoverflow.com/questions/3878303/c-udp-socket-port-multiplexing, I found that using DNAT PREROUTING, I can redirect the packets for a particular UDP port and listen to packets being received on it.
iptables -t nat -A PREROUTING -i <iface> -p <proto> --dport <dport>
-j REDIRECT --to-port <newport>
Unfortunately this w...
I am having a problem, but I cannot figure out what I'm doing wrong. I'm not sure if it's a problem with my loop, or the cin buffer is not being cleaned. I am doing a program that transforms a C-style string to uppercase, however if the user enters more than 11 characters, then the function should only display the first 11, and anything ...
I currently have a class that uses template arguments. I need an array of these. How could I do this (without boost).
ex:
template <typename RET, typename T>
class AguiTimedEvent {
RET (*onEvent)(T arg);
double timeStamp;
public:
RET call(T arg);
bool expired();
AguiTimedEvent();
AguiTimedEvent(RET (*Timefunc)(T ...
I read a few other articles on here that looked similar, but didn't quite answer my problem. I've been given a question for an assignment to assign every node in a binary tree its respective depth. I just can't quite get it.
For reference this is my code:
struct treeNode {
int item;
int depth;
treeNode *left;
treeNode *right...
Greetings all,
I load set of images and generate volume data.I save this volume data in a
unsigned char *volume
array.
Now I want to save this array in a file and retrieve.But before saving I want to compress the byte array since the volume data is huge.
Any tips on this?
Thanks in advance.
...
The disadvantage would be in comparison to a technique that was specialized to work on threads that are running within the same process. For example, does wait/post cause the whole process to yield, rather than just the executing thread, even though anyone waiting for a post would be within the same process?
The semaphore would be used,...
In C++0x (n3126), smart pointers can be compared, both relationally and for equality. However, the way this is done seems inconsistent to me.
For example, shared_ptr defines operator< be equivalent to:
template <typename T, typename U>
bool operator<(const shared_ptr<T>& a, const shared_ptr<T>& b)
{
return std::less<void*>()(a.get(...