Using C++ (VS2008) I need to be able to enumerate all shared folders on the current machine and get or construct the local and remote names.
We've been using NetShareEnum for this fairly successfully, but have hit a problem where we need to run with a user account with low privileges.
To get the local path using NetShareEnum we need to...
What are the differences between these four inline (key)words?
inline, __inline, __inline__, __forceinline.
...
Greetings,
Any input on a way to divide a std::vector into two equal parts ? I need to find the smallest possible difference between |part1 - part2|.
This is how I'm doing it now, but from what you can probably tell it will yield a non-optimal split in some cases.
auto mid = std::find_if(prim, ultim, [&](double temp) -> bool
{
if(...
How do you specify, in Visual Studio 2010, the order in which library files should be linked?
I have a project that links against libexpat and against another library. This library (not under my control) seems to also include libexpat. The problem is that 'we' use a different version of the library (XML_UNICODE vs not). In Visual Studio...
Say we have a code:
int main()
{
char a[10];
for(int i = 0; i < 10; i++)
{
cin>>a[i];
if(a[i] == ' ')
cout<<"It is a space!!!"<<endl;
}
return 0;
}
How to cin a Space symbol from standard input? If you write space, program ignores! :(
Is there any combination of symbols (e.g. '\s' or something li...
Is there any hack I could use to do this:
template <class TYPE>
class Hello
{
TYPE _var;
};
I would like a way to store
Hello<int> intHello and Hello<char*> charHello
into the same Container such as a Queue / List.
...
I want to perform "deep copies" of an STL container of pointers to polymorphic classes.
I know about the Prototype design pattern, implemented by means of the Virtual Ctor Idiom, as explained in the C++ FAQ Lite, Item 20.8.
It is simple and straightforward:
struct ABC // Abstract Base Class
{
virtual ~ABC() {}
virtual ABC * clo...
Can someone give me a brief definition of a reference variable in C++?
...
Is there a way for GCC to produce a warning while linking libraries that contain classes with the same name? For example
Port.h
class Port {
public:
std::string me();
};
Port.cpp
#include "Port.h"
std::string Port::me() { return "Port"; }
FakePort.h
class Port {
public:
std::string me();
};
FakePort.cpp
#include "FakePort....
In the standard library of C++ the value std::numeric_limits<T>::max() is specified as a function. Further properties of a specific type are given as constants (like std::numeric_limits<T>::is_signed). All constants that are of type T are given as functions, whereas all other constants are given as, well, constant values.
Whats the rati...
I am currently porting some Windows mobile C++ code to standard C++.
So I am trying to find alternatives for windows specific functions.
I have had very little luck in finding a standard C++ function that can help me replace the WSAGetLastError() windows specific function.
WSAGetLastError() returns error numbers for errors that occur ...
I am trying to use the WINAPI ReadConsole() to wait for any keypress at the end of my Win32 console application.
CONSOLE_READCONSOLE_CONTROL tControl;
char pStr[65536];
DWORD dwBufLen = 1;
DWORD dwCtl;
tControl_c.nLength = sizeof( CONSOLE_READCONSOLE_CONTROL );
tControl_c.nInitialChars = 0;
tControl_c.dwControlKeyState = 0;
tControl_c....
Hi,
I'm surprised this question wasn't asked before on SO (well, at least I couldn't find it).
Have you ever designed a method-callback pattern (something like a "pointer" to a class method) in C++ and, if so, how did you do it ?
I know a method is just a regular function with some hidden this parameter to serve as a context and I hav...
suppose a text file has 11001100 11001101
and i open the text file and take the input from the file as pt[0]=11001100, pt[1]=11001101..
but if i take the input from file as in>>pt it wont put it in two different arrays which is obvious but it takes the whole line . Thus I have to take another for loop and traverse through the whole...
I've seen the terms "IB" and "UB" used several times, particularly in the context of C++. I've tried googling them, but apparently those two-letter combinations see a lot of use. :P
So, i ask you...what do they mean, if they're said like it's a bad thing?
...
Given a simple class that overloads the '[ ]' operator:
class A
{
public:
int operator[](int p_index)
{
return a[p_index];
}
private:
int a[5];
};
I would like to accomplish the following:
void main()
{
A Aobject;
Aobject[0] = 1; // Problem here
}
How can I overload the assignment '=' operator in...
Hello,
I'd like to know if there is a way to create and launch a Remote Desktop Session on a Windows Server programmatically.
I'm trying to make an automatic tool to create Local Users and then launch the associate RDP session. I've already made LocalUser creation and adding them to Remote Desktop Users (using net.exe).
But I'm struck ...
I have a class and I want to create an array of a number instances, specifically a matrix class:
class Matrix {
public:
Matrix(int sizeX, int sizeY);
Matrix();
~Matrix();
....//omiting the rest here
private:
int dx, dy;
float **p
void allocArrays() {
assert(dx>0);
assert(dy>0);
p =...
Hi,
I'm having problem getting the value from a pointer. I have the following code in C++:
void* Nodo::readArray(VarHash& var, string varName, int posicion, float& d)
{
//some code before...
void* res;
float num = bit.getFloatFromArray(arregloTemp); //THIS FUNCTION RETURN A FLOAT AND IT'S OK
cout << "NUMBER ...
Can I do this in C++ (if yes, what is the syntax?):
void func(string* strs) {
// do something
}
func({"abc", "cde"});
I want to pass an array to function, without instantiating it as a variable. Thanks for suggestions.
...