|
Dont worry if your programs has problem its their problem not you,best way is delete that project.
|
|
|
|
|
tank??? arjun or t72
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I forgot you are Palini with a powerful compiler and also your programs can find their problems and when they find any error they delete that section of their code.
|
|
|
|
|
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
|
|
|
|
|
da link is blocked az porn sir. can u email me dat stuff plz.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
itz urgent?
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
|
|
|
|
|
|
Rajesh R Subramanian wrote: porn ... can u email me dat stuff plz.
Mee too. Send picz plz!
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
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?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hi experts,
I faced following situation sometimes...
I am using VS 2005. Sometimes Compiler forgets to warn or raise an error about inappropriate string initialization or functions or other string manipulation.
For example:
CString str = ”Hello”;
Gives error… and I correct this by prefixing “L” CString str = L”Hello”;
But sometimes somewhere in my code inside any function or loop
CString otherStr = ”Hello world”;
Gives neither warning nor error and runs correctly.
And when i change/modify that string CString otherStr = ”Hello world”; it gives error.
Finally i correct like this CString otherStr = L”Hello world”;
I am unable to understand this.please help me to understand this.
Thanks
modified on Friday, May 16, 2008 5:59 AM
|
|
|
|
|
all depends if you have unicode enabled in you project settings or not.
when you assign litterals to CStrings, you have to use _T() or TEXT() macros.
CString str = _T("Hello");
CStringA strAnsi = "Hello";
CStringW strUni = L"Hello"
the _T() macros will expand the literal text to either ansi or unicode regarding your project settings...
for your knowledge, here is how it's defined (kinda) :
#ifdef _UNICODE
#define _T(x) L##x
#else
#define _T(x) x
#endif
|
|
|
|
|
Sorry i forgot to say that when i change/modify that string CString otherStr = ”Hello world”; it gives error.
But sometimes somewhere in my code inside any function or loop
CString otherStr = ”Hello world”;
Gives neither warning nor error and runs correctly.
I mean if i touch that string, it starts to give error. And finally i correct like this CString otherStr = L”Hello world”;
|
|
|
|
|
Best way is to use _T macro. It will take care of everything.
Cstring str= _T("test it");
|
|
|
|
|
you are right.
but i was talking not only string intialization also about functions like:
strcpy() also shows the same behavior.
it accepts sometimes CString parameters while i am working with unicode settings.
|
|
|
|
|
it's because strcpy() is accepting ansi strings (char*) only, and if you have unicode defined, your CStrings convert implicitely to unicode string, not ansi (wchar_t*)
|
|
|
|
|
But why would the compiler complain about one and not the other? The OP stated that it only starts to complain about that other (second) one if it is modified?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: But why would the compiler complain about one and not the other? The OP stated that it only starts to complain about that other (second) one if it is modified?
Right. Now only you understand my question. I also want to know. Please sir, explain me about this strange behavior of complier.
BTW what is OP?
DavidCrow wrote: The OP stated that
|
|
|
|
|
how to enable a editcontrolbox when a particular radiobutton is selected???
Raja
|
|
|
|
|
By handling the radio button event and using EnableWindow()[^]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
how is the eventhandling done for radiobuttons,how to implement them
Raja
|
|
|
|
|
Right click on the Radio button -> Events -> Add handler.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Insert this code to your program or just double click on the Radio button.
//header file
afx_msg void OnBnClickedRadio1();
CEdit m_Edit;
//source file
BEGIN_MESSAGE_MAP(CddDlg, CDialog)
ON_BN_CLICKED(IDC_RADIO1, &CddDlg::OnBnClickedRadio1)
END_MESSAGE_MAP()
void CddDlg::OnBnClickedRadio1()
{
m_Edit.EnableWindow(1);
}
|
|
|
|
|
Hi,
I want to read a .txt file frequently.I wrote this code;
char *pbuf = new char(file.GetLength())
file.Read( pbuf,file.GetLength());
In this way occured an error and program shut down while it is running.
But when I wrote
char pbuf[100];
file.Read( pbuf,100);
this code doesn't produce an error. But I wil not know the size of the file.What can I do for that?
Thanks
|
|
|
|
|
Instead of
char *pbuf = new char(file.GetLength()) use
char *pbuf = new char[file.GetLength()];
Also, don't forget to delete []pbuf , when you've finished using it.
|
|
|
|
|
1/
new char [file.GetLength()];
2/
You are making a buffer exactly as long as the file - and as it's char buffer, you're likely to be expecting it to be NULL terminated. Which it won't be...
Your second example reads *upto* 100 chars, so will probably be less, and as that chunk of 100 bytes probably has a zero or two in it, you get away with it.
Make a text file 100 bytes long, and it would likely fail too.
3/
I'd put the size into a variable, if only for debugging purposes.
4/
You could also have some naughty person save a '\0' somewhere in the file, so your string would be messed up... Especially if this program ends up in the wild. The effect could be benign: "Ok, it will look like there was less text. big deal", or critical, depending on your code.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|