I need to download some csv files over http from the internet, parse it and convert it to a more useful fomat. Eventually a C++ program will consume the data. A few years ago, I would be pulling out my Perl books and start writing Perl scripts to do the downloading and parsing. But now with Boost and Qt I can do the download, parsing, an...
One of the libraries we are using for our product uses a singleton for access to it. I'm pretty sure it's implemented as a static instance (it isn't open source). This works well for a single document application, but our app may have more than one document loaded. I'm assuming access to the instance is written something like this:
Inst...
This function declaration gives me errors:
ostream& operator<<(ostream& os, hand& obj);
The errors are:
error C2143: syntax error : missing ';' before '&'
error C4430: missing type specifier
error C2065: 'os' : undeclared identifier
error C2065: 'obj' : undeclared identifier
error C2275: 'hand' : illegal use of this type as an expres...
Hello i'm making a program to get the names of users on my website and use that log for my programs so only registered people can login. How would I go about doing this?
...
The error occurs when I try to do this
friend std::ostream& operator<<(std::ostream& os, const hand& obj)
{
return obj.show(os, obj);
}
where hand is a class I've created, and show is
std::ostream& hand::show(std::ostream& os, const hand& obj)
{
return os<<obj.display[0]<<obj.display[1]<<obj.display[2]<<obj.display[3]<<obj.di...
The exact warning I get is
warning C4715: 'hand::show' : not all control paths return a value
and hand::show is
std::ostream& hand::show(std::ostream& os) const
{
if(side == left)
{
return os<<display[0]<<display[1]<<display[2]<<display[3]<<display[4];
}
if(side == right)
{
return os<<display[4]<<display...
Hi,
I have a class and I want to have some bit masks with values 0,1,3,7,15,...
So essentially i want to declare an array of constant int's such as:
class A{
const int masks[] = {0,1,3,5,7,....}
}
but the compiler will always complain.
I tried:
static const int masks[] = {0,1...}
static const int masks[9]; // then initializing ...
I get a warning in MSVC++ when I try to read an integer from a file and make a bool variable equal it.
accessLV[i] = FileRead(file1, i + 1);
(accessLV is an array of bools, FileRead is a function I made to decrease the syntax involved in reading from a file, i is because the statement is within a for loop)
I've tried using a static_c...
#include <iostream>
#include <string>
#include <fstream>
using namespace std ;
string strWord( int index , string line)
{
int count = 0;
string word;
for ( int i = 0 ; i < line.length(); i++)
{
if ( line[i] == ' ' )
{
if ( line [i+1] != ' ')
{
...
I need to design a data structure that supports the following operations:
search element in the data structure based on a key that is an interval. For example the value within interval 1-5 may be 3, from 6-11 may be 5 and so on. The intervals are contiguous and there is no overlap between them.
find previous and next interval - this i...
I was reading the linked question which leads me to ask this question.
Consider the following code
int main()
{
string SomeString();
}
All says, compiler takes this as a function prototype and not as a string object. Now consider the following code.
int main()
{
string Some()
{
return "";
}
}
Compiler said...
Doing cross platform development with 64bit. Using gcc/linux and msvc9/server 2008.
Just recently deployed a customer on windows and during some testing of upgrades I found out that although std::streamoff is 8 bytes, the program crashes when seeking past 4G.
I immediately switched to stlport which fixes the problem, however stlport se...
What I'm looking for is any/all of the following:
automatic discovery of worker failure (computer off for instance)
detection of all running (linux) PCs on a given IP address range (computer on)
... and auto worker spawning (ping+ssh?)
load balancing so that workers do not slow down other processes (nice?)
some form of message passing
...
I'm using Code::Blocks IDE with Gcc/minGW on Windows and I'm trying to build a wxWidgets application which has ca. 20k lines and 40 source modules. And it builds very very slow.
Compiling a cpp module lasts 2-5 seconds, and linking lasts even 2-3 minutes.
It's a portable code, this code on Linux compiles very fast. I can't follow the bu...
Can anyone help me with the compilation of C++ code in PHP on the Windows platform? I am using Microsoft Visual C++ 6.0.
I have tried the following options which I knew, but none of them work:
system('test.c')
exec('test.c')
The file 'test.c' has been placed in my php/www/ folder.
I need to first compile the code, which makes test....
I'm using Visual Studio 2005 and programming a dialog-based MFC application in C++. I have an edit box and I'm trying to make it auto-scroll. When I make auto vscroll true, it still won't auto-scroll when I have too many lines in my edit box. Any ideas in what could be wrong? Is there maybe some code line I have to add to my edit box?
...
If I want to declare a vector of unknown size, then assign values to index 5, index 10, index 1, index 100, in that order. Is it easily doable in a vector?
It seems there's no easy way. Cause if I initialize a vector without a size, then I can't access index 5 without first allocating memory for it by doing resize() or five push_back()'...
I've looked everywhere for this function and cannot find the header files to make this work.
It says clrscr() undeclared which brings me to the question. Is clrscr(); a fuction in C++?
...
I'm making an MFC dialog-based application in Visual C++ 2005. I added a scroll bar to an edit box. How do I program the scroll bar to make it work?
...
I'd like to write two distinct functions to handle a constant value and a variable of a given type (viz., int).
Here is the example test case:
int main(void) {
int x=12;
F(5); // this should print "constant"
F(x); // this should print "variable"
}
I thought it would be enough to define:
void F(int v) { cout...