I'm learning C++ using Vim as editor on Windows XP, however I found issue that I have list below.
I have downloaded and installed c.vim and it essential file, however when I start vim it show message C/C++ template file 'C:\Program Files\Vim\vimfiles\c-support/templates/Templates' does not exist or is not readable, I want to know how t...
The below function results in infinite loop if a string is entered as input.
istream & inputFunc(istream &is)
{
int ival;
// read cin and test only for EOF; loop is executed even if there are other IO failures
while (cin >> ival, !cin.eof()) {
if (cin.bad()) // input stream is corrupted; bail out
...
i ran into thos quesiton in a google search.... they look pretty common, but i couldn't find a decent answer. any tips/links ?
1.Remove duplicates in array in O(n) without extra array
2.Write a program whose printed output is an exact copy of the source. Needless to say, merely echoing the actual source file is not allowed.
...
This is more of a question of curiosity but does anyone know how negative precision values are handled in C++? For example:
double pi = 3.14159265;
cout.precision(-10);
cout.setf(ios::fixed, ios::floatfield);
cout << pi << endl;
I've tried this out and using GCC and it seems that the precision value is ignored but I was curious if ...
I am using the following code to draw Strings. In GDI+
Graphics tempFontGr(XXX);
Matrix* myPathMatrix = NULL;
myPathMatrix->Rotate(GetDCAngle(), MatrixOrderPrepend);
cantempFontGr.SetTransform(myPathMatrix);
tempFontGr.SetInterpolationMode(InterpolationModeHighQuality);
tempFontGr.SetSmoothingMode(SmoothingModeAntiAlias);
tempFontGr.Dr...
void outputString(const string &ss) {
cout << "outputString(const string& ) " + ss << endl;
}
void outputString(const string ss) {
cout << "outputString(const string ) " + ss << endl;
}
int main(void) {
//! outputString("ambigiousmethod");
const string constStr = "ambigiousmethod2";
//! outputString(constStr);
} //...
Hi
As there several ways to exchange data in the form of strings over sockets, such as e.g:
using functions like:
1) sprintf() and sscanf()
2) snprintf() and sscanf()
3) printf() and strtof()
or converting to char and then pass it as an array
I would appreciate if you could suggest which way and why is efficient and better than ot...
My company is thinking of dumping InstallShield and move to something else, mainly because of the poor experience it had with it, mostly on Linux.
Our product is a C++ application (binaries, shared libraries) targeted at Windows and Linux (Red Hat).
The installer itself isn't required to do anything special, just dump some binaries and...
I'm trying to generate ImageMagick images from SDL pixel data. Here's what the GIF looks like so far. (This GIF is slower than the one below on purpose.)
Here's what it's supposed to look like. Notice in the above image that the pixels seem to be overlayed on top of other pixels.
Here's where the GIF is actually created.
void Drv...
void outputString(const string &ss) {
cout << "outputString(const string& ) " + ss << endl;
}
int main(void) {
outputString("constant tranformed to reference argument");
//! outputString(new string("abc")); new only return pointer to object
return 0;
}
Since its prohibited to create temporary object reference transform...
I was writing a function in c++ the other day and it occured to me the compiler could do a lot more to help me guard against mistakes. The essentials of my code were like this -
void method(SomeType* p)
{
assert(p != 0);
p->something();
}
And it was called like this
SomeType p = NULL;
if (SomeCondition)
{
p = some_real_va...
I need to do something like this for my program's input:
stream input;
if (decompressed)
input.open(filepath);
else {
file_descriptor=_popen("decompressor "+filepath,"r");
input.open(file_descriptor);
}
input.read(...)
...
I can see 1 solution... to use _popen in both cases and just copy the file to stdout if it's already ...
I'm trying to export a simple class to Lua using LuaBind. I took the code from two sites which showed roughly the same way to do it, but it's still failing.
// Default headers
#include <iostream>
#include <string>
// Lua headers
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
#include "luabind/luab...
I've been developing Microsoft Windows based applications (both desktop and web) for several years using C#, .net, & Visual Studio with a dash of C/C++ & WIN32. I want to broaden my horizons and try out developing in a *NIX environment e.g. using Vim & C++. I have limited UNIX experience from a few school projects.
I'm having trouble ...
There are few things I'm not sure of :
When you create a basic SDI using MFC app wizard (let's call it TestMfc) you get :
4 major classes :
CTestMfcApp
CTestMfcView
CTestMfcDoc
CMainFrame
What I noticed is that CTestMfcApp has those declaration
ON_COMMAND(ID_APP_ABOUT, &CTestMfcApp::OnAppAbout)
// Standard file based document c...
Say a shared library contains the following lines:
const char* const arr[] =
{
"one",
"two",
"three"
};
1) Can an application link to this library and use the symbol "arr"?
2) Is binary compatibility broken if a new element is added to the definition?
3) How about if one of the string literals is changed?
4) Why (not)?
Cheer...
Hi,
As there are serveral ways of connecting multiclients to the server such as: fork, select, threads, etc. I would be glad if you could describe which is better to connect multiple clients to the server?
Thanks for you time and reply?
...
I am trying to exchange data between client and server using gSOAP. Actually, I succeeded to send data from client to server but not from server to client. So, could someone please explain what functions to use to pass data from server to client?
Thanks for your time and replies,
...
Hi,
I want to write a program which use NTL library under Dev-C++.
Could tell me how to add NTL libraries to Dev-C++?
I tried to compile (as it was said in NTL tutorial) all the files form src catalog in Dev-C++, but I got such a communicate:
[Bulid Error] [Project1.exe] Error 255
That's why I cannot get ntl.a file...
...
What is the difference between:
thread_envs[i] = soap_copy(&env);
and
thread_envs[i] = soap_new();
Sould we use one of them or both?
...