|
bob16972 wrote: On VC++ 6.0 I need these to get that to compile and run...
#include <iostream>
#include <tchar.h>
// Not sure if that helps...
Especially since it's a linker error.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Fair enough. I was just hoping they had been tinkering to get errors to go away and they were posting the latest error which may have been after changing project settings around etc...
I didn't realize the include for iostream was there since they didn't check the "ignore HTML tags in this message" box. I saw your other post and took a look at the html source and there it is.
I was hoping that maybe by starting a new project and copying and pasting the code with the includes would fix it if they had messed with the project settings before posting the latest errors.
I would assume VC++ 2005 would give the correct basis for a crt project but maybe I'm mistaken. This thread may help spark some ideas for the original poster...
ideas and shots in the dark[^]
|
|
|
|
|
Include
#include <iostream> .
Regards,
Paresh.
|
|
|
|
|
Paresh Chitte wrote: #include <iostream>
It already is being included. Furthermore, it's a linker error, not a compiler error.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Sorry for the late of reply, actually I did include #include <iostream>, I forgot to convert the tag to the literal string, so the browser always treat the opening tag as html code. Ok but my problem has been solved when I changed the setting, Project > properties > C/C++ > Runtime Library > Multi-threaded Debug DLL (/MDd) . Does anybody knows why is it so ? I am using Visual Studio 2005 professional,
|
|
|
|
|
Hi I need to manage a progressBar into MyThread class(CWinThread derived) using a timer but I can use the ON_WM_TIMER Event message.
How can I do it? Using the SetTimer function but how?
Thanks
|
|
|
|
|
CDRAIN wrote: How can I do it? Using the SetTimer function but how?
They hide that information in the Documentation[^]
led mike
|
|
|
|
|
Sorry, I made an error on the description of my problem:
I can't use the ON_WM_TIMER message because my class MyThread isn't derived from the CWnd but from the CWinThread.
How can I do this?
|
|
|
|
|
CDRAIN wrote: Hi I need to manage a progressBar into MyThread class(CWinThread derived)...
Does the progress bar belong to a different thread than the one you are creating?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes, the progress bar belong to the MainThread of my Application, and I need to manage it from my thread.
|
|
|
|
|
CDRAIN wrote: Yes, the progress bar belong to the MainThread of my Application, and I need to manage it from my thread.
Which is a sure-fire recipe for disaster.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
CDRAIN wrote: the progress bar belong to the MainThread of my Application, and I need to manage it from my thread.
in your first post you said
CDRAIN wrote: I need to manage a progressBar into MyThread class
I have no idea what to believe at this point. If your progress bar is in the main thread you DO NOT need to manage it from the worker thread. Instead you do something like this:
Progress Information Object
CWnd in main thread (Progress Bar or Window) has a reference to the Progress Information Object
CWinThread worker thread has a reference to the Progress Information Object and continuously updates the object to reflect the work in progress.
ProgressBar or Window sets a timer and on the timer event reads the progress information from the shared Progress Information Object and updates the ProgressBar state.
led mike
|
|
|
|
|
I developed a log parser in plain C in VS 2005. The essential for the parser is to take in buffer as much data for the processing as possible. I read file as a binary by using low level function “_read”. I discovered that the optimal size of the buffer is 100 kb. I need actually buffer approximately of 500kb. However when I increase the buffer’s size the processing time increases. It happens according to profile because the reading time increases. I would expect that reading larger portion of data should reduce reading time, but got opposite results. I assume it can depend on some compiler settings, but couldn’t find anything. I would appreciate any help in this matter.
Yefim
|
|
|
|
|
Hmm I don't know what I'm missing but reading 5 times as many bytes could take 5 times as long...
Are you accessing the file sequentially or randomly?
What flags are you specifying in the _open() call?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark thanks for fast respond.
I’m accessing this file sequently and here is the opening and reading part
iFin = _open(szSourceFile, _O_BINARY|_O_RDONLY);
szBufRead = 100000;
iGet=_read(iFin,szBufRead,iReadData);
Thanks again Yefim
|
|
|
|
|
Try _O_BINARY|_O_RDONLY|_O_SEQUENTIAL.
Internally, the CRT uses the Windows CreateFile() API to open the file when you call _open().
_O_SEQUENTIAL causes the FILE_FLAG_SEQUENTIAL_SCAN flag to be added to the dwFlagsAndAttributes
parameter passed to ::CreateFile(). Whether the system actually uses this flag, I don't know
That's the only place I can see to possibly optimize buffering, aside from disabling all system
buffering and handling it yourself.
Are you sure it's not just a matter of reading 5 times as many bytes at a time from a relatively
slow device?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
The strcpy below throw 'Access Violation'. Can anybody show me how to do it correctly? Thanks.
char **pArrayLabel = NULL;
int size=12;
pArrayLabel = new char*[size];
CString szLabel0 = "Januari";
strcpy(pArrayLabel[0],(char *)szLabel0.GetBuffer(szLabel0.GetLength()));
|
|
|
|
|
You're copying into an uninitialized pointer. You need to allocate a char buffer for each of the 12 char* s
|
|
|
|
|
I would do this:
char *pArrayLabel = NULL;
int size=12;
pArrayLabel = new char[size];
CString szLabel0 = "Januari";
strcpy(pArrayLabel,(char *)szLabel0.GetBuffer(szLabel0.GetLength()));
And when you pass it to the other function, pass it as "&pArrayLabel"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
once again, somebody is using CString::GetBuffer() when it's definitely not needed.
Call GetBuffer() only if you need to modify the CString object directly by writing inside its internal buffer. and this call to GetBuffer() requires a call to ReleaseBuffer() (which you don't do here).
if you only need to get the string contained within the CString, then you must use the cast operator (LPCTSTR) and that's it.
and for your problem, as that's been stated, you're assigning a NULL pointer.
modify your code into this.
ans at last, as i'm on it, please be careful with your variables names (generally, a variable starting with sz or psz is declared being a C-Style string)
const int iSize = 12;
TCHAR *pArrayLabel = ::new TCHAR[iSize];
CString strLabel = _T("Januari");
::_tcscpy_s(pArrayLabel[0], (LPCTSTR)szLabel0);
|
|
|
|
|
toxcct wrote: once again, somebody is using CString::GetBuffer() when it's definitely not needed.
Yeah, they should charge a toll $$$ to use CString::GetBuffer() and
CWnd::PreTranslateMessage() to help people consider alternative solutions
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
The (LPCTSTR) cast is superfluous there too, because the compiler will automatically call it when it sees that the _tcscpy() parameter is an LPCTSTR .
|
|
|
|
|
You already got enough information from other replies.
If you are using visual studio 2005, consider using secured version of these CRT function.
Refer Security enhancement to CRT[^].
Prasad
MS MVP - VC++
|
|
|
|
|
Hi,
Pls help anyone know how to control the brightness of avi. file??
Thanks in advance.
|
|
|
|