|
Use CFile obj.
Get the length of File in bytes by using
length = obj.GetLength()
progresslen = length \ 100
remaining = length - (progresslen*100)
progresslen++ //increment for remaining
set Progress Bar length to progresslen.
count = 0
progress = 0
while(count != length)
{
char pbuf[100]
UINT bytesread = obj.Read( pbuf, 100 )
//do processing for 100 bytes here
count += bytesread
progress++
ProgressBar.SetPos(progress)
}
Sameer();
|
|
|
|
|
Hello i want have 2 str str = "yes"(a word) and line = " yes i would like it yes"
and i want to test if the line contains the str (and how many times)
i mean
if ( line.GetAt(i) ==str.GetAt(1) && line.GetAt(i+1) == str.GetAt(2) && etc)
there is a way to put the for ( ) inside the if ( )
so if ( TRUE ) only when str exist in line
or anyone could suggest me a code to find how many times a CString str1 appears in a CString str2 ?
-- modified at 18:50 Thursday 17th May, 2007
|
|
|
|
|
Well, the code is wrong to start with, there are methods on the CString class to find a substring. Then you can set up a while loop that checks if you've moved past the end of the string, and keep looping until you can't find a substring.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, folks!
I develop test & measurement systems for our manufacturing operation. One of my systems' updates has introduced a very reliable crash and I'm having some difficulty tracking down the problem.
I have a desktop PC set up the same way as my testers (w/o the hardware). When I run the app in debug mode there I can trace the program flow through the call stack window (I'm using the VC 6 IDE as my debugger). However, when I try the same thing on real hardware the CS window is blank (even if I set a break at WinMain). Also, if I try to use the step out of function button, the status bar displays a message saying the function has no return address (yet stepping through it returns just fine!).
Any clues as to how I can solve this? Both locations read the same project (dsw and dsp) files, so the settings should be the same, right?
Here are links to window snapshots showing the debugger in action. The first image is running on the desktop system, showing the proper view of the call stack. The second image is running on the test system. Note the absence of any info in the call stack window. The last image is also on the hardware, but using Wndbg. Note that the call stack seems to be ok.
Desktop View
Hardware View
Hardware View using WnDbg
TIA!
'til next we type...
HAVE FUN!! -- Jesse
|
|
|
|
|
Hi Jesse,
Have you tried setting up a symbol server to see if that improves things ?
A little self promotion, but only because I am trying to help...
Setting up a symbol server
Also, I assume you have copied the .pdb file to the 'real hardware' machine ?
regards,
|
|
|
|
|
|
Thanks for the link. That certainly sounds like my problem; I'll have a look into it.
Again, thanks!
'til next we type...
HAVE FUN!! -- Jesse
|
|
|
|
|
cgreathouse,
That was it! Thank you very much.
Turned out that the imagehlp.dll on the system that worked was v 4.00. The version on the failing system was 5.00.2128.1. I replaced it with the v 4.00 and now I get a call stack.
Have a beer on me!
'til next we type...
HAVE FUN!! -- Jesse
|
|
|
|
|
how i can say str.GetAt(i) != letter (A-Z) so it could be 12345,./0- etc
|
|
|
|
|
Maybe use !isalpha(str.GetAt(i)) or !iswalpha(str.GetAt(i))
(_istalpha() is the generic TCHAR version)
See isalpha, iswalpha, _isalpha_l, _iswalpha_l[^]
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
thanks !
|
|
|
|
|
Is there a way to set an alternate directory for .ncb, .suo, and .aps files? They consume a lot of space on my USB flash drive. I can delete them as a temporary solution but then they get re-created later when I re-open the solution file.
|
|
|
|
|
I have an application that is writing data to a serial port. To allow all the data to be written before I do anything else I use while( pCom->tx_in_progress ){;} . While in the debug configuration this works without a problem but when I change to release and run the program it hangs. Any ideas?
Thanks.
|
|
|
|
|
Hi
do you have initial values in your parameters? Are you checking them before going into the loop. In debug the variables get values alone, but in release not. There are more messages about this problem in forum, take a look with search option
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
I am initializing the variable when I instantiate my class. The problem seems to be in the while loop. If I turn off optimization, or just have the default, for my release configuration it runs. When I optimize for "maximum speed" the program hangs. It must be how the compiler is dealing with the "empty" while loop.
Any ideas? Thanks.
|
|
|
|
|
masnu wrote: While in the debug configuration this works without a problem but when I change to release and run the program it hangs. Any ideas?
Refer this[^] article by Joseph M. Newcomer.
Prasad
MS MVP - VC++
|
|
|
|
|
Thanks Prasad (and Joseph). I found the answer in his article.
For those who are curious the problem came about in the declaration of tx_in_progress. It was declared as int tx_in_progress . When I wrote while (pCom->tx_in_progress) {;} and optimized for speed the compiler assumed nothing in the loop modified the variable so it never checked it again, creating an endless loop. The solution is to declare it as volatile int which tells the compiler not to make any assumptions about the variable. I'm pretty sure that is the cause of it. If anyone has something different please let me know.
Great article by Joseph. Thanks.
|
|
|
|
|
please ..source code for program in oop in c++
i can't write program in c++ in oop please i want to be expert in oop
LORAN
To Be Or Not To Be
(KARFER)
|
|
|
|
|
Do you know C++ ? see MFC/C++ [^] is helpfuls?
|
|
|
|
|
You should search the definition for the "class" word, once you've read that you'll understand what is the oop about...
Then making that code will be easy (at the beggining) of course you can make it as hard as you want, but for example, look for the CButton source code or any other control in the MFC, and then you'll understand.
Hope this helps.
|
|
|
|
|
how can i check the stack-overflow through my programme.
|
|
|
|
|
|
thank you,i am reading it now!
|
|
|
|
|
I hope it solved your problem.
|
|
|
|
|
//this is add to stack function
<br />
void push (int x)<br />
{<br />
if (top >size -1)
cout <<"Stack is full";<br />
else<br />
<br />
stack[top++]=x;
}<br />
<br />
int pop ()<br />
{<br />
if (top >0)<br />
return stack[top--];<br />
else<br />
cout <<"stack is empty";<br />
}<br />
O.K ...
Go Head ...
To Be Or Not To Be
(KARFER)
|
|
|
|