|
ya i have seen previous link but wen i dowloaded demo file frm dat link der was no dsw file or exe file so i was not able to connect those files n was not not able to detect the flow of the program so it didn't worked out 4 me
|
|
|
|
|
neha.agarwal27 wrote: ...no dsw file or exe file...
The project contains a .dsp file. Open that instead. No .exe is provided as you can build one yourself.
BTW, this is not a cell phone, PDA, or other IM device. Loose the SMS-speak and you'll get much more help.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
how in debug mode watch the contents of the vector<> it only shows first elemnt only, and not tmp[i] telling it is not possible
9ine
|
|
|
|
|
9ine wrote: how in debug mode watch the contents of the vector<> it only shows first elemnt only, and not tmp[i] telling it is not possible
It's quite easy.
For eg: if you have an array like
int *pnData = new int[20]; // Fill out pData here
Now select pnData and press Shift + F9 for quick watch window.
This will only show you the first value. Now in order to see next value type the following...
pnData[0]
pnData[1]
pnData[2] Same with vector too...
Select the variable that denotes the array in a vector, that is the internal data pointer in quick watch window.
Now follow the same procedure that you did for pnData .
Hope this helps...
|
|
|
|
|
Another option is in the watch window, use
<br />
pnData,20<br />
That will show 20 elements.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
krmed wrote: Another option is in the watch window, use
pnData,20
That will show 20 elements.
This is real nice. Thanks for this info. I didn't know about this. A 5. Do you know any more of such tricks.
|
|
|
|
|
Hello All
I am using english OS WIN XP, in which Japanese character can be used using Microsft IME.
The file names are stored in a text file which is SHIFT-JIS encoding.
when I read the file names form the file using I am getting some encoded file name in a charcter buffer.
fgets( szFilename, pFP );
fills the szFileName with character that is not the same of the filename.
But I want to open the file after reading the filenames from the text file
i.e I want this two step
fgets(szFilename, pFP);
fopen( szFileName, "r");
I know the problem is in character encoding. But can't find any solution. Any hiht to proceed please
Regards
Anil
|
|
|
|
|
Use WideCharToMultiByte()
Rinu Raj
|
|
|
|
|
Thank you very much.
I was able to do it with the above funtion. forgot to thank you on that day
Regards
Anil
|
|
|
|
|
Hello comunity,
it is posible to modify an content from an LPCTSTR variable!?
Example:
<code>
CString csStringContent = "This is an String";
LPCTSTR lpsz = csStringContent;
</code>
with best regards
break;
|
|
|
|
|
break; wrote: CString csStringContent = "This is an String"; // modify to "This is String" or replace a part of themLPCTSTR lpsz = csStringContent;// modify lpsz?
with best regards
csStringContent = "This is String";
LPTSTR lpsz = csStringContent.GetBuffer();
lpsz[0] = _T( 't' );
csStringContent.ReleaseBuffer(); Or
csStringContent = "This is String";
LPCTSTR lpszC = csStringContent;
LPTSTR lpsz[0] = const_cast< LPTSTR >( lpsz );
lpsz[0] = _T( 't' );
|
|
|
|
|
Nibu babu thomas wrote: CString csStringContent = "This is an String"; // modify to "This is String" or replace a part of themLPCTSTR lpsz = csStringContent;// modify lpsz?
Generally, if you want to modify the LPCTSTR, then you are making something wrong.
You can:
1. csStringContent[0] = 'a';
2. use various member function of CString
3. use CString only when necessary:
TCHAR str[100] = "This is a string";<br />
_tcscpy(str[2], "aaa";<br />
CString cstr = str;
4. use CString::GetBuffer() as already described;
Playing with the LPCTSTR ... no way.
|
|
|
|
|
Agreed, casting the const away as done above is not on - I'd fire someone for doing this.
Steve
|
|
|
|
|
Your second method is just plain evil - although you mentioned it sould be avoided I'd go as for as to say you shouldn't have even mentioned it as an option. Even if it works on one MFC verion it may stop working in a later version.
Steve
|
|
|
|
|
Stephen Hewitt wrote: Your second method is just plain evil - although you mentioned it sould be avoided I'd go as for as to say you shouldn't have even mentioned it as an option. Even if it works on one MFC verion it may stop working in a later version.
Sometimes when you don't have any other option you are forced to do this. But it should be avoided. I just mentioned this so that if he didn't have any other option he can use this. I just went for his question.
|
|
|
|
|
Hello,
i dont need to delete some chars from the LPCTSTR, it is ok when i can change them,
my solution is this:
<code>
LPCTSTR lpsz = csContent.GetBuffer();
LPSTR lpstr = (LPSTR) lpsz;
while(*lpstr)
{
if(something)
{
_strnset(lpstr, ' ', 1);
}
}
</code>
regards
break;
|
|
|
|
|
GetBuffer returns a non-const pointer. Make your code look like this:
LPTSTR lpsz = csContent.GetBuffer(100);
csContent.ReleaseBuffer();
You don't need to have a LPCTSTR which you cast to LPSTR ; this is strange and confusing to say the least. Also note that you need to call ReleaseBuffer and that GetBuffer takes a minimum buffer size parameter.
You should not be calling GetBuffer at all however: this is designed when you need to manipulate the contents of a CString with code that doesn't know anything about CString s. If your writing code to manipulate the CString you should use its member functions. Why use a string wrapper if you're just going to get a pointer to the underlying buffer and manipulate it directly?
What exactly are you tring to do?
Steve
|
|
|
|
|
Hello,
i dont need to delete some chars from the LPCTSTR, it is ok when i can change them,
my solution is this:
<code>
LPCTSTR lpsz = csContent.GetBuffer();
LPSTR lpstr = (LPSTR) lpsz;
while(*lpstr)
{
if(something)
{
_strnset(lpstr, ' ', 1);
}
}
</code>
regards
break;
|
|
|
|
|
There are several things wrong with what you are asking, and I'll try to hit on a few of them.
1) You are using CString, which gives you access to the buffer, will manage the memory for you, and can be modified in many ways using its given member functions ... yet you want to grab the buffer from it and operate on it yourself? To me, this indicates that you haven't read the documentation on what CString actually does for you.
2) LPCTSTR stands for "long pointer to a constant t-string". You do NOT want to modify a constant, period. Casting away the const (which is what your "solution" code is doing) is both dangerous and wrong.
3) Because you called GetBuffer, and never called ReleaseBuffer, you created a memory leak. This problem goes away immediately when you fix #1 by using CString's methods.
A much better solution would be to do something along the lines of this:
csContent.Replace(SomeValueIWantChanged, _T(' '));
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hello,
thanx for answer, well, i read about CString and i love it to use, and i use it hier only for posting, in real the source come from a file, open with fopen();
maybe from an html file to.I need some quick method to lookup through a file, and this file can be wery large.
I dont know if the CString functions like CString::Find() or CString::FindFirst() are the quickest for this!
Also, the source is an stream, file stream!
That is the cause why i ask about!
with best regards!
break;
|
|
|
|
|
Consider using OpenFile or ofstream to open the file instead of fopen. Also, if you use ofstream, you can use the string class instead of CString. It has similar functions to CString, and you also gain the ability to use some of the more complex STL algorithms if you need them.
I'm assuming this is an actual file you are opening (that is, it isn't a serial port) so if you wanted to, you could easily load the entire file into memory to parse it.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi all,
I have designed a MFC based Dialog application. I have a parent dialog and a corresponding child dialog.
My requirement is this. My parent dialog has a edit box. Which should display value form 0 to n without stopping although the child window is opened or closed.
Just like a clock it should be incrementing the value by itself. Which function do u suppose can be used to achieve this?
I tried WM_TIMER but to no avail. It increments once and then stops.
Please some one tell me as to which function or handle can accomplish this.
Thanks and Regards in Advance
Kenny
|
|
|
|
|
Use a thread function to implement the edit box updation.
Threadproc()
{
m_edit = 1; // edit box member variable
while( 1 )
{
m_edit++
UpdateData(FALSE);
sleep( 10 )
if( m_edit == n ) // return if n is reached
{
return;
}
}
Rinu Raj
|
|
|
|
|
Hi all,
I want to draw some diagrams (rectangles ...etc) and put text in to it..
I have used TextOut() function to write the text...
But I want to reduce the font size ....
Now it takes current font settings of Device Context...
How do I make it ?
Thanks in advance....
vinsankar
|
|
|
|