|
Here's a nice writeup[^] on the subject. He emphasises on MFC, but the idea is the same.
A book on threading would be of immense help to you.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
So in a normal C++ environment you can use fstream!
CFile in MFC applications, does anyone know of other file writing functions that don't involve MFC.
While also restricting output with number of bytes to write?
|
|
|
|
|
Fareed Rizkalla wrote: does anyone know of other file writing functions that don't involve MFC.
How about WriteFile() and fprintf() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
You could start here[^] and work your way up. The basic IO functions require you to do all the work, in terms of formatting your data.
It's time for a new signature.
|
|
|
|
|
I have a lot of legacy code using fprintf(stderr, .....); I also have monitoring pane which is a CEdit control. How can I redirect stderr to output into the CEdit control?
I have a look around but most of the answers involve the creation of a new process. Is any simpler way of doing it? Effectively what I 'd like to do is something like
start redirection of stderr to myEditControl;
fprintf(stder, ....);
finish redirection of stderr
Thanks
|
|
|
|
|
It's not a trivial task. See here and here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Thanks, I have already looked at it but they involve a CreateProcess call. Which means an extra process. This is what I want to avoid actually.
|
|
|
|
|
Have anybody compile PDFlib Lite 7.0 to get pdflib.lib file ? PDFlib offer a lite version of their library , 7.0.4 , but must compile to obtain a valid library ... I don't know how ! Can anybody help me ? Source code is here , only must download , compile to get pdflib.lib file ... My error is :
LINK : fatal error LNK1181: cannot open input file "pdflib.lib" , or really this I want to get it !
|
|
|
|
|
Looks like you are trying to include a library file that does not exist. Have you successfully compiled all the source files?
It's time for a new signature.
|
|
|
|
|
I downloaded and extracted all the source.
I opened the PDFlib.dsw and had VS2005 convert all projects. (The ZIP is for VS6 and I'm using VS2005)
I rebuilt the DEBUG PDFlib project only and it successfully produced the PDFLib.lib file.
When compiling however it will generate a lot of warnings about unsafe functions.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
Seems I make it , after yours model , I get an pdflib.lib file ... now I try to use in an test project ... thank you all !
|
|
|
|
|
Finally , I generate a blank pdf page with pdflib 7.0.4 ...
|
|
|
|
|
Congratulations. Good effort.
Just remember that the light at the end of the tunnel might be an oncoming train.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
hi
string Str;
Asc(Mid(Str, i, 1)) in vb and i want in vc++
Chr$(Str(i)) in vb and i want in vc++
i donot vb...please help any one
|
|
|
|
|
Member 3653751 wrote: i donot vb...please help any one
There is the documentation, by the way.
Member 3653751 wrote: Asc(Mid(Str, i, 1))
The ASCII value of a the ith character of the string.
(in C++ is the character value itself, if you have a char array).
Member 3653751 wrote: Chr$(Str(i)) in vb and i want in vc++
You dont't need it in C++ (neither in VB , AFAIK).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
native C++:
static_cast<int>(Str[i - 1]);
static_cast<wchar_t>(Str[i]);
C++/CLI:
Convert::ToInt32(Str[i - 1]);
safe_cast<Char>(Str[i]);
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
In my previous post I realized I pretty messed up my project with unneeded templates.
I thought "what about creating a structure or class with a pointer to another structure and putting that pointer just when needed?"
So here's the question: I dislike personally the idea of a pointer pointing to optional data, is there any better solution to store data which always has a common header but then may vary?
---
|
|
|
|
|
create a class to store the 'common header'. then, use that as a base class and derive objects from it to store the 'optional' data.
?
|
|
|
|
|
I don't really know about your requirements, but a union may possibly be an option.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
? :
class A
{
...
};
class B
{
A* m_pA;
public:
B(A* pA = NULL) { m_pA = pA; };
};
int main()
{
A a;
B b1;
B b2(&a);
...
return 0;
}
virtual void BeHappy() = 0;
|
|
|
|
|
The hierarchy proposal is good I have to admit it.
But I need to use data stored in this class in the easiest way possible, something like
MYclass a;
a.GetPoints();
CalculateOtherData( a.RetrievePoints() );
and the hierarchy isn't that simple
---
|
|
|
|
|
4288 wrote: But I need to use data stored in this class in the easiest way possible, something like
MYclass a;
a.GetPoints();
CalculateOtherData( a.RetrievePoints() );
and the hierarchy isn't that simple
So what does any of this have to do with, "...is there any better solution to store data which always has a common header but then may vary?"
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
That structure of points may vary.
---
|
|
|
|
|
I have a dialog box that's mostly working except for one thing. Under certain circumstances, if another window covers it for any reason, then when it's unhidden there is nothing in the dialog box until you move it slightly - no controls at all, just a gray background. I figure I need to stick an Invalidate() somewhere, but I can't figure out where.
The dialog box has a rich edit control and a bunch of buttons. Some of the buttons load different HTML files into the rich edit control (the HTML is converted to rich text). One of the buttons hides the rich edit control and displays a jpeg (which was easier than trying to load the jpeg into the rich edit control). One of the buttons prints whatever is displayed. If it's a rich edit control, it prints what's in it. If it's the jpeg, it prints that.
All this is working. I handle WM_PAINT so the jpeg is continually displayed if the window is resized or moved. OnPaint() checks the report type being displayed, and then if it's the image, it redisplays the image.
To fix the disappearing dialog controls after the window is hidden I added a handler for ON_ERASEBKGND that basically does the same thing as OnPaint(). If the jpeg is the current report, it redraws the jpeg. This works - but only for the jpeg. If the currently displayed report is in a rich edit control, every control in the dialog disappears after it's covered by another window - including the buttons. I've tried every combination of return values I can think of (0, 1, calling the base method), but nothing restores the controls except moving the dialog.
What am I missing? How do I get the dialog to redraw after being hidden when the rich edit control is being displayed?
|
|
|
|
|
Does your dialog have the "clip children" style set? If no, try enabling it and see if it helps.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|