|
paul_71 wrote: While each C++ compiler must be able to process C-code and
You are right paul. Actually, I am looking for fastest free C compiler only, but C++ is also acceptable as it can also compile C code.
As you mentioned, specialized C compiler for generating fast/best optimized binaries would be the best for me.
|
|
|
|
|
Hi all,
when i m trying to stop running thread ,than some time exception occur and point out on this location in call stack
> test.exe!CMapPtrToPtr::GetNextAssoc(__POSITION * & rNextPosition=0xfeeefeee, void * & rKey=0xfeeefeee, void * & rValue=0xfeeefeee) Line 294 C++
i dont understand whats going wrong please help me for this.
thanks in advance.
|
|
|
|
|
IIRC when you see an object with the bit pattern 0xfeeefeee in VC++ it means the object's been deleted. So my first guess would be you've got a map and and you're trying to delete it twice, or trying to use it for something after it's been deleted.
Cheers,
Ash
|
|
|
|
|
Are you trying to stop thread A from within itself, or from some other thread?
"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
|
|
|
|
|
i m doing like this.
class CTimerTh :: CWinThread
{
}
class CMy_Th::CTimerTh
{
}
//i create thread with AfxBeginThread and use here CMy_Th as run time class and and save its return pointer in std::map<int, CMy_Th*> ass
ass[0] = (CMy_Th*) AfxBeginThread( RUNTIME_CLASS(CMy_Th),THREAD_PRIORITY_NORMAL, NULL,CREATE_SUSPENDED,
NULL);
std::map<int, CMy_Th*>::iterator pos = ass.find(0);
if(pos != ass.end())
{
if(pos->second!=NULL)
{
CMy_Th* pThread = pos->second;
pThread->PostThreadMessage(WM_QUIT,NULL,NULL);
}
ass.erase(pos);
}
</pre>
please me to resolve the error.
thanks in advance.
|
|
|
|
|
Le@rner wrote: pThread->PostThreadMessage(WM_QUIT,NULL,NULL);
See here. I prefer to let threads kill themselves, and use events to signal between them.
"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
|
|
|
|
|
hi all,
i m working on SDI type application ,i want to set some minimum size of application.
please tell me how can i do this.
thanks in advance
|
|
|
|
|
Le@rner wrote: i m working on SDI type application ,i want to set some minimum size of application.
In your CMainFrame class, you could implement a handler for WM_GETMINMAXINFO like this:
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
int min_x = ::GetSystemMetrics(SM_CXSCREEN) / 4;
int min_y = ::GetSystemMetrics(SM_CYSCREEN) / 3;
int cx = lpMMI->ptMinTrackSize.x;
int cy = lpMMI->ptMinTrackSize.y;
lpMMI->ptMinTrackSize.x = (cx < min_x) ? min_x : cx;
lpMMI->ptMinTrackSize.y = (cy < min_y) ? min_y : cy;
CFrameWnd::OnGetMinMaxInfo(lpMMI);
}
This example will give you a minimum of 1/4 the screen width and 1/3 the screen height. You could also use hard-coded number of pixels, although this might not scale well for different monitor sizes.
|
|
|
|
|
|
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.cy = 100;
cs.cx = 100;
return TRUE;
}
You can set your custom size with use of cs.cy and cs.cx parameter
|
|
|
|
|
Hi all,
i want to calculate time that is taken by execute a function.
i m doing it like this.
DWORD dw = ::GetTickCount();
dw = ::GetTickCount() - dw;
CString time_str;
time_str.Format("%d ms", dw);
AfxMessageBox(time_str);
is it right way to do this.
thanks in advance.
|
|
|
|
|
You can get much better resolution with the APIs QueryPerformanceCounter() and QueryPerformanceFrequency() . Use ...Counter much like you use GetTickCount, and ...Frequency to calibrate your results. Hit MSDN for more info and examples.
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
I have a binary file of size 3GB. I want to reduce the size using some coding in C to write another binary file.
Please suggest/provide a way to write compact binary file.
TO read this file i need to use C#.
Thanks,
Sachin
|
|
|
|
|
WinZip(3GB_Filename, 2GB_Filename); ?
Seriously, it depends on what is contained in the 3GB binary file. Is it even compressible?
If it contains lots of NULLS, for example, change the NULL bytes to a single NULL followed by a count of how many there are. A string of 10 NULLS would turn into a single NULL and a byte with the number 10 in it, saving 8 bytes.
Reading the file in, you would simply reverse the process.
1,2,3,4,5,0,0,0,0,0,0,0,0,0,0,1,2,3,a,b,c,0,0,0,0,d,e,0,f,ff
(30 bytes)
Becomes
1,2,3,4,5,0,a,1,2,3,a,b,c,0,4,d,e,0,1,f,ff
(21 bytes)
Alternatively, implement one of the Open Source Zip and Unzip routines in your C and C# code, as appropriate.
Gary
|
|
|
|
|
check this library.
http://zlib.net/[^]
use following function from library for compress binary file.
deflateInit
deflate
deflateEnd
|
|
|
|
|
I've used (libbzip2[^]) in the past with some success at shrinking certain types of binary file. Hopefully there's some repetition in it or whatever you try isn't going to be able to do much to shrink it.
Cheers,
Ash
|
|
|
|
|
|
fatal error LNK1104: cannot open file "hid.lib"
please give me any solution.
|
|
|
|
|
Ruchira Patel wrote: fatal error LNK1104: cannot open file "hid.lib"
Check if the file mentioned in the error message("hid.lib") is present or not.
If the file is in some 3rd party libraries installed in system, give the correct path in "Additional include directories" option of your project settings.
--
"Programming is an art that fights back!"
|
|
|
|
|
rp_suman wrote: give the correct path in "Additional include directories"
This is a library file, not an include file. The folder should be mentionned in "Additional Library Directories".
|
|
|
|
|
i've actually meant library path only.. thanks for the correction..
regards
--
"Programming is an art that fights back!"
|
|
|
|
|
Make sure this file exist on your system and can be found by the compiler (it should either be in the project directory or located in one of the "Additional Library Directory" (project settings -> "Linker" -> "General" -> "Additional Library Directory").
|
|
|
|
|
Ruchira Patel wrote: please give me any solution.
See 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
|
|
|
|
|
Hi,
i am working on a simple application that needs to be updated frequently, do you have an an article that discusses how an application downloads the update then install it. Like an anti virus, it downloads the update definitions then install it on its own.
lets say its an application that collects updates from a common share-point.
lets not focus on the install part, what we want to focus is on the connection and download part..
and what are the common protocol and ports used for connection?
i got some good hint from Simon Ellis's article, An AutoUpdate Trick An AutoUpdate Trick[^], but i still can't find where is the download part,
any help or guide will be much appreciated, thanks in advance
|
|
|
|
|
loid grey manuel wrote: lets say its an application that collects updates from a common share-point.
I used a repository with version information, the application checks what needs to be downloaded. After successful download, checksum verification and unpacking the updater checks modification time on a per file basis, to decide which binary really needs to be replaced. If you plan to update multiple files, make sure they will be replaced together (to avoid dependency issues).
To my knowledge there is no simple automatic update mechanism on Windows, you probably need an extra executable for: stopping your application, replacing files and restarting you application again (all should be UAC compatible for Vista/Win7).
loid grey manuel wrote: and what are the common protocol and ports used for connection?
I did all network communication via HTTP, this means repository and downloads are on a web server.
Hope it helps.
|
|
|
|
|