|
ui_offset has to be a constant.
Try this -
const UINT64 ui_offset = <value>;
LONGLONG ll_array[ui_offset];
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hiiii....
I tried with
const UINT64 ui_offset = 1000000;
LONGLONG ll_array[ui_offset];
It works properly...
Thanking you......
|
|
|
|
|
What is woring in my following codes run time error is occuring for both code
int main()
{LPTSTR strResult;
LPTSTR strDefault=L"no";
DWORD d=255;
GetPrivateProfileString(L"data",L"Patchcab ",
strDefault,strResult,d,
L"D:\\TMP\\patchpolicy.ini");
printf("%s",strResult);
}
int main()
{
LPTSTR strResult=L"";
LPTSTR strDefault=L"no";
DWORD d=255;
GetPrivateProfileString(L"data",L"Patchcab ",strDefault,strResult
,d,L"D:\\TMP\\patchpolicy.ini");
printf("%s",strResult);
}
|
|
|
|
|
There is no memory allocated for the LpReturnedString parameter.
You're declaring it as LPTSTR strResult which is only a pointer.
You will need to do this -
TCHAR strResult[255];
DWORD d = 255;
Also change printf to _tprintf .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
|
Hey, I think this is just a little mistake somewhere. I am new to using the STL algorithms, so i am totally botching it somehow.
My code looks like this:
typedef std::string Node;
typedef std::vector<Node> Cluster;
and down in the code i want to do this:
bool contains (const Cluster& cl, const Node& n)
{
Cluster::iterator it = find (cl.begin (), cl.end (), n);
(it == cl.end ()) ? return false : return true;
}
is that possible? or am i not allowed to do that? Thanks in advance!
|
|
|
|
|
Looks good except for the last return.
It should be return (it == cl.end ()) ? false : true;
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
«_Superman_» wrote: It should be return (it == cl.end ()) ? false : true;
return (it != cl.end());
FFY from me & Jijo.
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
[My articles]
|
|
|
|
|
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Howdy'
I have some very bad code that should crash but I'm having difficulty figuring out why it does not crash (or even give out warnings); it works in VS2003 in release&debug and in VS2008 in debug, not in release.
class Info
{
public:
Info();
Info(std::wstring s1, std::wstring s2);
std::wstring m_string2;
};
struct myStruct
{
std::vector <Info*> m_JobInfoVector;
};
m_MyStruct = (myStruct*)malloc(sizeof (myStruct) );
ZeroMemory(m_MyStruct, sizeof(myStruct));
Info* p = new Info( std::wstring(_T("allo")) );
m_MyStruct->m_JobInfoVector.clear();
Question : What happens to the vector member when the ZeroMemory is called ? and why it does not crash in debug but it does in release ?
Thanks.
Max.
This signature was proudly tested on animals.
|
|
|
|
|
Why worry? The code is erronous, so the result of executing it is undefined. Just replace your malloc with new myStruct ...and don't, just don't ever write over a class with something like ZeroMemory - it just doesn't make sense. You have constructors to initialise structs and classes in C++.
But anyway - the error is in comparison of iterators (which clear does) - in VS2008, Debug mode iterators are different to Release mode iterators unless you specifically enable iterator debugging, which probably has something to do with it.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I know that, but I was wondering why it did not crash; anyway, the code has been fixed.
Thanks.
This signature was proudly tested on animals.
|
|
|
|
|
I think you are assuming that a struct in C++ works the same way as a struct in plain old C, but alas it doesn't... well not really anyway.
When you introduce non-primitive data types into structs in C++ they cease to be simple "data structures" and become basically the same as classes only their members default to public instead of private.
My guess is when you try to overwrite the object you are writing over the beginning of its virtual table which probably contains extra debug information in debug mode. In release mode you are then probably overwriting more important class data.
Remember, the sizeof operator is not designed to get the size of an object or its virtual table.
http://en.wikipedia.org/wiki/Virtual_method_table[^]
Chris Smith
|
|
|
|
|
Thanks, that's probably it; me think i will look at the memory a little closer.
This signature was proudly tested on animals.
|
|
|
|
|
hi,
My program creates files dynamically for that I gave location as desktop.
This code I wrote inside a fr loop, that means how many times this loop continues that many number of files will be created. For this situation how can I mention path that should able to generate any number of files.
sampath-padamatinti
|
|
|
|
|
What are you talking about? You already said that you're creating files on the desktop. What is your query?!
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
char directory[] = "my desktop";
for (int i=0;i<numFiles;++i)
{
char filePath[MAX_PATH];
sprintf(filePath, "%s\\%d.ext", directory, i);
} ?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
In addition to Stuart's reply,
There is an API to create file names, uniquely GetTempFileName
It will give a filename in specified directory with the prefix. It will automatically set a unique file name if you insist to do so. Read the MSDN for detailed information. An example is given here
|
|
|
|
|
It probably would have been better to reply to the OP rather than me
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: It probably would have been better to reply to the OP rather than me
Hello Madhu Nair, I agree with Stuart.
Sorry, couldn't resist.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: I agree with Stuart
Of course you do - everyone agrees with me...if they know what's good for them
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I'm not sure if you got the pun. I've modified the previous post to make it clearer.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I've really no idea as to what you are talking about but if I were to hazard a guess, are you wanting to create a different file each iteration of the loop?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hi everyone, I got a question about disabling context menu of the web browser and I've searched MSDN, this forum and goole. But seems most of the are either not Dialog Based (most of them use CHtmlView) or not quite same as what I see in my project.
I am using Visual Studio 2005 and Here is my steps of creating the application:
I use MFC application and choose dialog based. Then, in the dialog editor, I add Microsoft Web Browser into the toolbox, and then drag it into the dialog. After that, I right click on that control and choose Add Variable and leave everything default and give it a variable name "myBrowser". Then it automatically creates a explorer.h and explorer.cpp. The explorer.h contains a class declearation of "class CExplorer1 : public CWnd". Then I get stuck at this point. I've tried to declear a message map in explorer.h and find ON_WM_CONTEXTMENU() but seems doesn't work.
From the search of the internet, it seems that I need to implemente IDocHostUIHandler and there I can overload ShowContextMenu() and return S_OK to disable it. But with most of the information I got, seems most of them are for CHtmlView but not CWnd. So, I'd like to ask what I should do to disable the context menu of a Dialog Based Web Browser which inherit CWnd (or my approach is wrong?) and with Visual Studio 2005? (coz I see most of the information are VC++6 and I can't find the same thing in VS2005).
I am new to MFC and these kinds of browser things so my question maybe a stuipd question....
Thanks for any help.
modified on Thursday, July 2, 2009 7:32 PM
|
|
|
|