|
You can use std::string as Christian suggested then, I assume you mean you can't use CString because you are using Borland CPP, or linux CPP with KDevelop or something.
I suggested CString because this forum is supposed to be for Visual C++.
I also assume that if you meant you don't want to use MFC, that you'd have posted something along the lines of "I don't wanna use MFC"
CString is readily available to Visual C++ CPP projects through the MFC headers
Mazdak wrote:
Beer wrote:
I think CString is for you.
I'm using C++.
Mazy
No sig. available now.
hey
|
|
|
|
|
This would happen to me when I had memory leaks. The program would run just fine and then unpredictably it would crash whenever I would allocate memory.
Try to use a constant instead of "size" variable. Try different values and if your program runs fine and never crashes then you must have a memory leak.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Hi!
I've just about to release a new MFC app. All works in debug ver. When I go to release it crashes when I work with radio buttons - always at L-button up from selecting a new radio btn.
Then I do the classics: Change from/to all thinkable optimazations - nothing happens! Can anyone of you think of why? It has no effect to build with MFC-dll's as static.
?????????????
Regards
Michael Mogensen, dev. mm it-consult dk.
|
|
|
|
|
Hi,
Keep in mind that in debug mode your pointer variables are initialized, in release they are not, maybe you are counting on a certain value on a non initialized variable ?.
if you can post some code perhaps we can help you more.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Pay Good attention to code that is written in ASSERT statments (or any code/macro that is excuted in debug builds only). This code is only called in Debug Versions. For example if you have something like this
CWnd *pWnd = NULL;
ASSERT(pWnd = GetDlgItem(ID_ANYTHING));
pWnd->ShowWindow(SW_HIDE);
This code will crash under release but will work under debug
Change the ASSERT into VERIFY.
Ralph Varjabedian
Software Engineer
|
|
|
|
|
|
One of the most common causes of this that I have seen is due to message handlers that don't have the correct signatures. I'm pretty sure the article that Neville mentioned discusses this issue. You might want to read KB article Q195032.
If you are using VC 6, you can send me an email containing your email address and I'll send you a modified version of afxmsg_.h that contains the changes suggested in Q195032. This will catch most cases of message handlers with incorrect signatures.
--------
There are 10 types of people in this world. Those who know binary and those who don't.
|
|
|
|
|
Thank you for your kind answer!
I an using VS6.0 yes - I look forward to a mail from you! Thanx' again!
Regards,
Michael Mogensen, mm it-consult dk.
|
|
|
|
|
Hi !
I'd like to start developping an application, using only standard C++ to make it work for Windows and Linux as well.
I was wondering how it is possible to create a thread in C++ so that it will work for both OS, because I guess the way it works for windows is different from the way for Linux.
Any help will be greatly appreciated !
Thanks
Jerome
|
|
|
|
|
No. No one thread will work in both OS. One solution is to implement multiple threads via templates.
Kuphryn
|
|
|
|
|
You can have a look at the posix standards for writing portable code.
If you have access to msdn, there is a section on porting unix apps to windows.
- Kannan
|
|
|
|
|
Boost has a portable C++ thread class that hides the OS thread implementation details.
|
|
|
|
|
|
Hi all,
In the following code:
typedef map < string , CEO* > ceoMap;
typedef ceoMap::iterator ceo_iterator;
I get the folloing errors:
error C2143: syntax error : missing ';' before '<'<br />
error C2059: syntax error : '<'<br />
error C2238: unexpected token(s) preceding ';'
I am out of ideas. Please advise.
|
|
|
|
|
I assume you've already included <map> which then means that you should either add
using namespace std; there somewere or use
typedef std::map< string, CEO* > ceoMap;
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Did you remember your #include and using directive?
<br />
#include<map><br />
<br />
using namespace std;
|
|
|
|
|
|
Well ,there is another error that I am unable to resolve
Consider the code:
#ifndef __EVENT_H__
#define __EVENT_H__
using namespace std ;
#pragma warning(disable : 4786)
class Simulation ;
class Event
{
public:
...
..
. I get the following compliler error:
error C2871: 'std' : does not exist or is not a namespace.
What am doing wrong. I was unable to deduce somthing from MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcce/htm/err26xx_28.asp[^]
|
|
|
|
|
Silly me
Please disregard.
|
|
|
|
|
Hi I have a problem with sorting dates in a Listcontrol. When I add some dates they are sorted by day but I want to sort them by day AND month AND year of course. How do I do that? (sorry for the probably stupid question)
now I get
e.g.
1. 13 May 2003
2. 14 February 2005
3. 15 August 2001
4. 16 May 2003
And I want
1. 15 August 2001
2. 13 May 2003
3. 16 May 2003
4. 14 February 2005
please help me!
|
|
|
|
|
The sorting that is being performed is a string sort - i.e. they are in alphanumeric order. What you need to do in the sorting function is convert the textual representation of the date to say, a CTime, then determine the order from that.
The other option is to display the date in the format YYYY/MM/DD; when you do this the string sort operation correctly sorts the dates!
|
|
|
|
|
Whats the problem with this code:
HANDLE f = CreateFile(sFilename,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_HIDDEN,NULL);
DWORD count = GetFileSize(f,NULL);
char *pszIn;
pszIn = (char *)malloc(count);
DWORD rec;
ReadFile(f,pszIn,count,&rec,NULL);
but psIn receice nothing and no byte read from file,and last error is : 998:Invalid access to memory location
Any idea?
Mazy
No sig. available now.
|
|
|
|
|
Interesting. Use C++ new instead of malloc.
char *pData = new char[count+1];
pData[count] = '\0';
Kuphryn
|
|
|
|
|
I have cut/pasted your code into a Mickey Mouse test prog, it works fine, have you tried doing that?
So if the code works, your fault is "probably" somewhere else in your program, unless ot course you are opening a "special" file, or a very large one?
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
Well the first thing I would do is test if CreateFile() succeeded. If it didn't, you are up the creek without any paddles. You should also test that the malloc was successfull etc.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|