I am trying to compile a program I wrote in C++ for an assignment that uses pthreads. I am using Eclipse in Linux, and I didn't have any problems compiling, after I added "-lpthread" to the compiler arguments (to g++, gcc and linker). However, when I was about to run and debug, Eclipse gave me an error message window "Launch failed. Bina...
I'm debugging part of a large project in Visual Studio 2005, and stepping through the code line by line.
int speed = this->values.speed;
int ref = this->values.ref_speed;
After stepping past the first line, values.speed has a value of 61, but for some reason, speed is getting assigned the value 58. After the second line, values.ref_s...
i cannot use fopen on files includes in their name some characters (example : ş, ç, ı)
how can i use fopen on these files ?
i'm using vc++ 6 (i have to) and c language.
when i was trying to use _wfopen it's never open any file.
...
I need to put a static array into a .cpp file. This array is only used in this .cpp so I want to declare it static. The array definition is quite big, so naturally I want to forward declare it.
static int bigIntArray[5000];
/* other code using bitIntArray */
static int bigIntArray[5000] = {
0x00, 0x9900, 0xffee,
...
};
VC 9.0 gi...
When I try to do things like this:
char* prefix = "Sector_Data\\sector";
char* s_num = "0";
std::strcat(prefix, s_num);
std::strcat(prefix, "\\");
and so on and so forth, I get a warning
warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead.
Why is strcat considered unsafe, and is there a...
I am trying to use the StructSerlialiser code given under What’s the best use you’ve had with pointer to members and member functions?
After populating the FieldBinderList, how do I access the pointer to member with the base class list? I need to do this if I want to set that field with a value read off an XML file.
...
Is there a simple way of creating a std::string out of an const char[] ?
I mean something simpler then:
std::stringstream stream;
stream << const_char;
std::string string = stream.str();
...
how do i declare a two d array using new?
like for a "normal" array i would:
int* ary = new int[Size]
but
int** ary = new int[sizeY][sizeX]
a) deosn't work/compile and b) doesn't acomplish what:
int ary[sizeY][sizeX]
does.
...
What does the C++ standard say about using dollar signs in identifiers, such as Hello$World? Are they legal?
...
Question: I have a COM server with a method as IDL:
[id(2), helpstring("method ExtractAvailableScanners")]
HRESULT ExtractAvailableScanners(
[in] VARIANT scanFilter, [out] VARIANT* scanPresent,
[out,retval] LONG* retVal);
In the header file this becomes:
STDMETHOD(ExtractAvailableScanners)
(VAR...
I'm working on a large c++ built library that has grown by a significant amount recently. Due to it's size, it is not obvious what has caused this size increase.
Do you have any suggestions of tools (msvc or gcc) that could help determine where the growth has come from.
edit
Things i've tried: Dumpbin the final dll, the obj files, cre...
What is a good way to return success or one or more error codes from a C++ function?
I have this member function called save(), which saves to each of the member variables, there are at least ten of these member variables that are saved-to, for the call to save(), I want to find out if the call failed, and if so, on which member variabl...
I have a Windows Template Library CListViewCtrl in report mode (so there is a header with 2 columns) with owner data set. This control displays search results. If no results are returned I want to display a message in the listbox area that indicates that there were no results. Is there an easy way to do this? Do you know of any exist...
I have code like this:
class MapIndex
{
private:
typedef std::map<std::string, MapIndex*> Container;
Container mapM;
public:
void add(std::list<std::tring>& values)
{
if (values.empty()) // sanity check
return;
std::string s(*(values.begin()));
values.erase(values.begin());
i...
When I run a program using the read part of fstream, I get this return value:
-1073741819
the actual function is part of a corrupt for loop, which I will try to explain:
for(int i = 0; i < vrs_top_i * 3; i += 3)
{
int X1x = FileRead(file2, i + 1);
int X1y = FileRead(file2, i + 2);
char X1sym = FileRead(file2, i + 3);
viral_data.a...
We are seeing a slight difference in how bcc32 and bcc32ide behave on a file. bcc32ide works and bcc32 crashes. Would there be any detrimental side effects to switching to bcc32ide for our automated builds? Also what is the difference between these two compilers? (other than one crashes and one doesn't)
...
Given a handle to a Windows Registry Key, such as the ones that are set by ::RegOpenKeyEx(), is it possible to determine the full path to that key?
I realize that in a simple application all you have to do is look up 5 or 10 lines and read... but in a complex app like the one I'm debugging, the key I'm interested in can be opened from a...
I have a visitor class resembling this:
struct Visitor
{
template <typename T>
void operator()(T t)
{
...
}
void operator()(bool b)
{
...
}
};
Clearly, operator()(bool b) is intended to be a specialization of the preceding template function.
However, it doesn't have the template<> syntax ...
I need to be able to pass a typename as a parameter:
int X = FileRead(file, 9, char);
The concept is for FileRead(std::fstream, int pos, ???) to read pos*sizeof(whatever the type is) to get the desired position. I tried templates:
template<typename T>
T FileRead(std::fstream file, int pos, T type)
{
T data;
file.read(reinter...
I have a class in c++ a portion of which is below
class Node{
public:
vector<string> getNames() const;
private:
vector<string> names_;
};
vector<string> Node::getNames(){
return names_;
}
the function getNames() passes a copy of the vector. How can i modify my class so that i can reference the vector 'by con...