I try to use _tcstoul for string to unsigned long conversion.
However, it doesn't treat -ve string input as invalid input. Is there any workaround for this? Or I had missed out something?
#include <cstdio>
#include <tchar.h>
int main() {
{
unsigned long iResult(0);
TCHAR *pszStopString;
iResult = _tcstoul(_...
All right, so I have been very frustrated trying to convert a 12-bit buffer to an 8-bit one.
The image source is a 12-bit GrayScale (decompressed from JPEG2000) whose color range goes from 0-4095. Now I have to reduce that to 0-255. Common sense tells me that I should simply divide each pixel value like this. But when I try this, the ima...
I understood multi-dimensional arrays as pointers to pointers, but perhaps I am wrong?
For example, I though:
char * var = char var[]
char ** var = char* var[] or char var[][]
char *** var = char var[][][] or char* var[][] or char** var[]
Is this incorrect? I was confused because I saw a char*[][] cast as a char** in a simple...
I'm building a custom authentication subpackage for MSV1_0 for Windows 7. I've used the msvsubauth sample in from the Windows SDK and I have 2 questions regarding some problems I'm facing with that:
When I'm trying just to make sure that the routine get's invoked and set the Auth0 property in the registry to my package and add a simple...
Hi,
I am new to all the functional stuff in STL. I tried to do smething but it fails horribly no matter how I try it. Please comment:
#include <iostream>
#include <algorithm>
using namespace std;
class X
{
public:
void Print(int x)
{
cout << x << endl;
}
void Do()
{
...
Is the following code valid C++?
const int var = 10;
{
int var[var]; // why doesn't this give any error ?
}
Note : The code compiles on my g++ compiler.
...
hello,
i need to use clucene in my c++ apps and i have installed i tried using with my eclipse i cant find the library specication with clucene how to add the library say
in project Properties->GCC c++ linker is there is any way to find the library name
...
Show the accurate running time of each line and total running time for the following function:
int f1(int n, int A[ ], int B[ ])
{
if ( (n>=5) || (n<0) )
return 0;
for (int i=0; i<=n; ++i)
{
A[I] = 0;
for (int j=0; ...
On my C++ project, I recently stumbled upon a little problem: Templates.
I declared a class, Data in my header file (which is shared by each .cpp), and gave it a template function. I implemented it in data.cpp. I soon remembered how templates are compiled on the spot, when they are referred to, and this breaks the declaration/implementa...
hello,
i have a queue of urls and i am passing to an function it crawls and gets the url each url in a queue should be in parellel and crawl is an class and start is my function it crawls the url
and if i run the program the each urls is executed one by one not in parallel
while(!q.empty())
{
#pragma omp parallel for
...
Show the accurate running time of each line and total running time for the following function:
int f1(int n, int A[ ], int B[ ])
{
if ( (n>=5) || (n<0) )
return 0;
for (int i=0; i<=n; ++i)
{
A[I] = 0;
for (int j=0; j<i; ++j)
...
I'm currently creating a concept which uses Boost::Serialization and which needs to implement its own Boost::Archive cause the data has to be serialized in a certain way.
There is documentation about implementing custom archives in the documentation:
http://www.boost.org/doc/libs/1_44_0/libs/serialization/doc/index.html
But I'm curious...
Hello everyone,
I wish to send some components to my customers. The reasons I want to deliver source code are:
1) My class is templatized. Customer might use any template argument, so I can't pre-compile and send .o file.
2) The customer might use different compiler versions for gcc than mine. So I want him to do compilation at his en...
I have a C++ library that doesn't use namespaces. I want to port it to Objective-C. The problem is the name collisions between the two. I want it to have the same name in Objective-C that is the name of the C++ object. But, I just can't figure out the best way to do this without it just becoming a mess. I am hoping for a solution to this...
I needn't use the QT's dlls and I want to use libs, when I run exe.How can I do this?
...
The problem: I've wrapped some c++ code in python using SWIG. On the python side, I want to take a wrapped c++ pointer and down-cast it to be a pointer to a subclass. I've added a new c++ function to the SWIG .i file that does this down-casting, but when I call it from python, I get a TypeError.
Here are the details:
I have two c++ cl...
COleVariant var(bstrString);
var.ChangeType(VT_DATE);
DATE date = var.date;
not seems to be working. Any ideas will be appreciated. Thanks.
...
And exact the media type then save the captured image with correct extension?
...
I installed boost on cygwin, and tried to compile the following program:
#include <iostream>
#include <boost/thread/thread.hpp>
using namespace std;
void hello() {
cout << "Hello cworld" << endl;
}
int main() {
boost::thread t(hello);
t.join();
}
via
$ g++ test.cpp -lboost_thread
/usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../...
Hi,
This cites for_each as follows:
template<class InputIterator, class Function>
Function for_each(InputIterator first, InputIterator last, Function f);
I have a collection std::list<std::string>, and a function void Do(std::string) works fine when given to for_each along with the iterators. But if I supply a function like void ...