I'm on the path to write a QCoreApplication supposed to create an external process via Qprocess.
I've just noticed that even if the waitForStarted() is called and the process state is Running before the event handler is executing, the external process does not start until the exec() method is invoked on the QCoreApplication.
That sai...
I have read the answers for this question but I'm wondering if there is a better way to do this using standard c++ libs? Preferably without trying to open the file at all.
Edit: Thanks for the answers so far, but I'm still stuck... Both "stat" and "access" is pretty much ungoogleable. What should I #include to use these?
...
I have been trying to include a file in a included file e.g
main.cpp file
#include <includedfile.cpp>
int main(){
cout<<name<<endl;
}
includedfile.cpp
#include <iostream>
using namespace std;
string name;
name = "jim";
this code does not work, the debuger says that name is not defined.
...
I have to deal with very large text files (2 GBs), it is mandatory to read/write them line by line. To write 23 millions of lines using ofstream is really slow so, at the beginning, I tried to speed up the process writing large chunks of lines in a memory buffer (for example 256 MB or 512 MB) and then write the buffer into the file. This...
I have a written a Visual C++ console application (i.e. subsystem:console) that prints useful diagnositic messages to the console.
However, I would like to keep the application minimized most of the time, and instead of minimizing to the taskbar, appear as a nice icon on the system tray. I would also like to restore the console when the...
class C {
T a;
public:
C(T a): a(a) {;}
};
Is it legal?
...
This code:
#include <iostream>
int main( int, char **argv )
{
std::cout << 1.23e45 << std::endl;
}
prints
1.23e+045
when compiled with MS Visual Studio 2003, and
1.23e+45
on my Linux machine.
How can I specify the width of the exponent field (and why is there a difference in the first place)?
...
I receive this Run-Time Check Failure upon the return in the following code. I believe similar code is running fine elsewhere in the program. Any ideas?
String GetVariableName(CString symbol, CString filepath)
{
char acLine[512];
char acPreviousLine[512];
CString csFile;
FILE *fp;
csFile.Format("%svariables.txt", f...
Duplicate:
What happens if you call erase on a map element while iterating from begin to end
How to filter items from a stdmap
I have a map map1<string,vector<string>> i have a iterator for this map "itr".
i want to delete the entry from this map which is pointed by "itr".
i can use the function map1.erase(itr); after this lin...
I have an MFC legacy app that I help to maintain. I'm not quite sure how to identify the version of MFC and I don't think it would make a difference anyway.
The app can take some parameters on the command line; I would like to be able to set an errorlevel on exiting the app to allow a bat/cmd file to check for failure and respond app...
template <class M, class A> class C { std::list<M> m_List; ... }
Is the above code possible? I would like to be able to do something similar.
Why I ask is that i get the following error:
Error 1 error C2079: 'std::_List_nod<_Ty,_Alloc>::_Node::_Myval' uses undefined class 'M' C:\Program Files\Microsoft Visual Studio 9.0\VC\include...
My new project is targeting an embedded ARM processor. I have a build system that uses a cross-compiler running on an Ubuntu linux box. I like to use unit testing as much as possible, but I'm a little bit confused about how to proceed with this setup.
I can't see how to run unit tests on the ARM device itself (somebody correct me if I...
As I understand, the pimpl idiom is exists only because C++ forces you to place all the private class members in the header. If the header were to contain only the public interface, theoretically, any change in class implementation would not have necessitated a recompile for the rest of the program.
What I want to know is why C++ is no...
I have a not-so-small class under development (that it changes often) and I need not to provide a public copy constructor and copy assignment.
The class has objects with value semantics, so default copy and assignment work.
the class is in a hierarchy, with virtual methods, so I provide a virtual Clone() to avoid slicing and to perform ...
Hi,
I'd like to implement a big int class in C++ as a programming exercise. A class that can handle numbers bigger then a long int. I know that there are several open source implementations out there already, but I'd like to write my own. I trying to get a feel for what the right approach is.
I understand that the general strategy i...
I'm still getting used to the sizers in wxWidgets, and as such can't seem to make them do what I want...
Basicly I wantt a large panel that will contain a list of other panels/boxes, which each then contain a set of text fields
----------------------
| label text box |
| label2 text box2 |
----------------------
-----------------...
I am trying to access a view inside a splitter from my mainframe. At the moment I have this:
CWnd* pView = m_wndSplitter.GetPane( 0, 0 );
However this gets me a pointer to the CWnd not the CMyViewClass object.
Can anyone explain to me what I need to do in order to access the view object itself so I can access member functions in the f...
I have this code:
CCalcArchive::CCalcArchive() : m_calcMap()
{
}
m_calcMap is defined as this:
typedef CTypedPtrMap<CMapStringToPtr, CString, CCalculation*> CCalcMap;
CCalcMap& m_calcMap;
When I compile in Visual Studio 2008, I get this error:
error C2440: 'initializing' : cannot convert from 'int' to 'CCalcArchive::CCalcMap &'
...
I have a class derived from CTreeCtrl. In OnCreate() I replace the default CToolTipCtrl object with a custom one:
int CMyTreeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CTreeCtrl::OnCreate(lpCreateStruct) == -1)
return -1;
// Replace tool tip with our own which will
// ask us for the text to display with a T...
If I do this:
// In header
class Foo {
void foo(bar*);
};
// In cpp
void Foo::foo(bar* const pBar) {
//Stuff
}
The compiler does not complain that the signatures for Foo::foo do not match. However if I had:
void foo(const bar*); //In header
void Foo::foo(bar*) {} //In cpp
The code will fail to compile.
What is going on?
I'm usin...