Here is what I am trying to do:
1) Open an ofstream object in my main body. I can do this no problem.
2) Associate this object with a filename. No problem.
3) Pass this object to a class and send output within this class. I can't do this.
Here is my code. I would appreciate any help. Thanks!
#include <fstream>
#include <iostream>
u...
Is there any way in Win32 to programmatically determine the bandwidth of a given network interface without actually transferring any data? I only want to distinguish between different types of interface (e.g. dialup vs DSL vs LAN), so a rough order of magnitude is fine, I don't need to actually measure the bandwidth.
Background to the ...
Hi,
I have a bunch of generic code that is used a lot, which i'd like to poke into in order to deal with a bug in a certain specific case.
So I'd like to break on a set of breakpoints only if some other breakpoint has been hit. Is there a way to do this in Visual 2005? I'm using C++ code.
Thanks!
...
I have a function that gets a std::string. That function calls
RegSetValueEx
the 5th parameter is the value of the registry value and expects a variable of type const BYTE*.
So I have to convert the std::string to const BYTE* and also give the length of the resulting array as the 6th parameter.
I have found a way to do it, but it feel...
How can I launch a URL in a NEW window using C++ (Windows only)?
The straight-forward approach seems to open a new tab in an existing browser window. (Or, if tabbed browsing is disabled, the new URL hijacks the existing browser window).
This is for a (large) desktop app, using MFC and Qt.
...
TextBoxes created by "CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", ES_MULTILINE.."
require \r\n for a new line.
im redirecting my stdoutput into that textbox, which uses just '\n' to indicate a new line. and im not willing to replace all '\n' with '\r\n'
isn't there a way to let '\n' beeing a newline in textboxes?
thx
...
How do I programmatically determine the network connection link speed for an active network connection - like Task Manager shows you in the Networking tab? I'm not really after the bandwidth available, just a figure for the current connection, e.g. 54Mbps, 100Mbps etc.
...
I have a Mac Plugin for viewing images. It's originally written in Quickdraw, and I'm trying to move it to Quartz.
My current problem is the origin. In QD, the origin is (sensibly) the upper left corner of the plugin rectangle. In Quartz, it appears to be one screen height below the top of the plugin rectangle (not including firefox but...
I'm fairly new to C++, and I'm not sure about this one. Have a look at the following example which sums up my current problem.
class Foo
{
//stuff
};
class Bar
{
Foo foo;
};
So Bar constains a full Foo object, not just a reference or pointer. Is this object initialized by its default constructor ? Do I need to explicitly call...
Similar to this problem here:
Old Question about C# debugging
I'm trying to debug a library that's used in multiple projects and is compiled using Intel's C++ v 11 compiler (ie, not the standard compiler) in Visual Studio 2008. The current platform I'm using to debug is a C# program that calls the C++ method through a p/invoke.
Is th...
I am trying to create an array of class objects taking an integer argument. I cannot see what is wrong with this simple little code. Could someone help?
#include <fstream>
#include <iostream>
using namespace std;
typedef class Object
{
int var;
public:
Object(const int& varin) : var(varin) {}
} Object;
int main (int argc, char * c...
In C++ the problem is simple.
I have 2 classes one contains the other as part of its implementation.
struct A
{
void do_something()
{
};
};
struct B
{
A obj_A;
void hello_world()
{
};
};
Now the problem is that structure B is one byte larger if A is part of B when I do a sizeof(B) and object of type B. A ...
How do i design a multithreaded C program to avoid Semaphore Mutex Concurrency
...
Hi,
I was wondering if its possible / anyone knows any tools out there to compare the execution of two related programs (for example, assignments on a class) to see how similar they are. For example, not to compare the names of functions, but how they use syscalls. One silly case of this would be testing if a C string is printed as (see...
Below I have written a sample program that I have written to learn about passing a list of objects to another class. I talk about the problems I am having below.
#include <iostream>
#include <vector>
using namespace std;
class Integer_Class
{
int var;
public:
Integer_Class(const int& varin) : var(varin) {}
int get_var() { return va...
I have noticed some applications (like steam) are able to start/stop services as a normal user with out invoking the uac control. Does any one know how to do it?
OS: Vista/Win 7
Visual Studio 2005
C++
.
Edit: I was playing around with the steam service last night trying to work out how it is different. If i put my service exe where th...
hello,
If my C++ app crashes on Windows I want to send useful debugging information to our server.
On Linux I would use the GNU backtrace() function - is there an equivalent for Windows?
Also, is there a way to extract useful debugging information after a program has crashed? Or only from within the process?
Richard
(Advice along the...
I have a method that requires a const char pointer as input (not null terminated). This is a requirement of a library (TinyXML) I'm using in my project. I get the input for this method from a string.c_str() method call.
Does this char pointer need to be deleted? The string goes out of scope immediately after the call completes; so th...
I think I'm failing to understand some finer point of C++. I want to set up a log of what my program does, and discovered std::clog, which seems to do what I want in theory, but in practice it doesn't.
If I do the following, clog works as expected and writes "Test 1" to the screen, and "Test 2" shows up in a file:
int main ()
{
clo...
I'm working on a cross platform profiling suite, and would like to add information about the machine's CPU (architecture/clock speed/cores) and RAM(total) to the report of each run. Currently I need to target Windows and Unix, so I need methods to obtain this information from both platforms, any clues?
Edit: Thanks for the great answers...