|
How do you load your dll?
|
|
|
|
|
|
Im not sure this[^] thread does solve your program or not but anyway see that thread maybe it some helpfuls for you.
|
|
|
|
|
|
I am still working on it. thanks!
|
|
|
|
|
Tal S. wrote: code written at VS 2003 which uses VS6/MFC6.
Why 6?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
VS2003 is version 7 and comes with MFC version 7. So I'm confused - are you writing code in
VS2003 and building it with VS 6?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
You are right it is VS2003 with MFC ver. 7!!! not 6!!!
|
|
|
|
|
hi i am I have created a class that encapsulates the open session, open request, send request, read response until buffers are empty and the closes the connections. When I create the first instance, everything work perfectly. I then destroy the object and create another object. This time everything seems to be working fine until the code hits the HttpSendRequest routine. At this point it hangs and never returns. All routines and parameters before the call were successful and had valid values.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
hi all,
i want to write a map to a file and then read it again.
but while reading it is not wrorking(i think it is writing properly).
the map declaration is:
typedef map<int,logsettings> MapType;
typedef MapType::value_type ValuePair;
where LogSettings is a structure:
struct LogSettings
{
unsigned long dwSession;
TCHAR *szFilePath;
TCHAR *szInfection;
TCHAR *szAction;
TCHAR *szMessage;
TINFECTIONSTATE iAction;
};
where TINFECTIONSTATE is just a enum.
to write to a file th function is:
int DataToFile((LogSettings &lgsettings)
{
MapType Map;
Map.insert(ValuePair(1,lgsettings));
FILE* f = fopen("C:\\sample.txt","wb");
size_t n = fwrite(&Map,sizeof(Map),1,f);
fclose(f);
return (int)n;
}
while writing the sturcture is initialised to some values.
To read the map:
MapType Map1;
FILE* fd = fopen("C:\\sample.txt","rb");
size_t nm = fread(&Map1,sizeof(Map1),1,fd);
fclose(fd);
MapType::iterator iter = Map1.begin();
//while(iter !=Map1.end())
{
cout<<(*iter).first<
|
|
|
|
|
First, please use the code tag when you post code.
Your code will never work: if you want to save a map to a file, you'll need to use another technique. First, you need to save the number of elements in your map and then save each element independently. To read the file, first read the number of elements and then extract each element one by one and add them to the map.
To save your element (LogSettings), you'll also need to use another method: as there are pointers in your structure, you cannot simply give the address of your structure to fwrite. This will save the pointers as what they are: an address (so you'll save and address in your file and not the data). You'll need to save each member of your structure independently (and for a string, you'll need to save first the number of characters and then your string).
|
|
|
|
|
I dont think writing to file in the following manner works. My sugeestion is to iterate through the map, take each structure, write each element of the structure seperately. While reading do the revers.
Did you check what sizeof(Map1) returns?it will return only 12/16 bytes.
nave
|
|
|
|
|
Hi,
I am getting problem with system menu when application is running on
64Bit PC with 64 bit os.
The problem is "System menu close button is disabling when application
is minimized and maximized".
This code is working fine with 32 bit Machine and 32 bit OS.
Please help for solving this problem.
Thanks,
Brahma.
Are
|
|
|
|
|
I am trying to create a file of bytes from my character array
const char* chars with length int count.
I wrote the C++ code:
FileStream file = new FileStream(S"chars.dat", FileMode::Create,
FileAccess::Write);
BinaryWriter binary = new BinaryWriter(file);
binary.write(chars, count); //it might just be binary.write(chars)
binary.close();
My compiler doesn't recognize FileStream and BinaryWriter, and when I try:
using namespace System::IO;
the compiler says that a namespace with this name does not exist.
Is my code correct, and what "using" or "include" do I need?
Also, I copied new FileStream(S"pixels.dat",...) from somewhere and I
don't know what the "S" means?
(By the way, I will later want to read this file in Java using DataInputStream.)
Thanks for reading this.
|
|
|
|
|
You are mixing languages.
- If you want to use the FileStream class then C# will be appropriate.
- If the chosen language is C++ then use std::fstream (or a C-like FILE * ).
- You can also use managed C++ to access FileStream class, but it is not the simplest solution.
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.
|
|
|
|
|
why you are not trying with fwrite?
|
|
|
|
|
Well, thanks for suggesting doing it in a simpler way.
My standard C++ code is now:
fstream file;
file.open("chars.dat", ios::out | ios::binary);
file.write(chars, count);
file.close();
and it works!
|
|
|
|
|
Im trying to improve my STL skills at the moment and wondered of there is a nice way to do the following.
I have a map that maps a string to an integer. I use it to count the number of times I get specific message for an entity identified by the string. What I want to do is find the string with the highest count. Obviously I can do this by itterating through the map but I wondered if its possible to do it another way?
|
|
|
|
|
Josh Gray wrote: but I wondered if its possible to do it another way?
Like keeping a reference to the one with the highest count.
led mike
|
|
|
|
|
led mike wrote:
Like keeping a reference to the one with the highest count.
I was hoping for some nice use of the algorithm stuff, like a combination of for_each and ????
Im just playing around with some unit tests and a tad bored
|
|
|
|
|
Josh Gray wrote: Im just playing around with some unit tests and a tad bored
Ah, ok, just don't give yourself any bad habbits like forgetting the KISS principle. (Keep It Simple Stupid)
led mike
|
|
|
|
|
This falls outside of STL, but you could use Boost MultiIndex[^] with a hashed unique index for the messages and an ordered non-unique index for the counts.
|
|
|
|
|
Hi,
you could use the following simple code
std::vector<std::string> vWords;
vWords.push_back("the");
vWords.push_back("eye");
vWords.push_back("of");
vWords.push_back("the");
vWords.push_back("tiger");
vWords.push_back("the");
vWords.push_back("eye");
vWords.push_back("of");
vWords.push_back("the");
vWords.push_back("beholder");
std::map<std::string,int> mapCheck;
int iMax = 0;
std::string strMaxWord;
for(std::vector<std::string>::const_iterator cIndex = vWords.begin(); cIndex != vWords.end(); Index++)
{
mapCheck[*cIndex]++;
if(mapCheck[*cIndex] > iMax)
{
iMax = mapCheck[*cIndex];
strMaxWord = *cIndex;
}
}
I hope that this helps or at least point you in the right direction
codito ergo sum
|
|
|
|
|
Hi
I am trying to understand the function of m_pMainWnd. But i have a problem.
For example
BOOL CMyApp::InitInstance()<br />
{<br />
CMyWindow *MyWindow = new CMyWindow();
m_pMainWnd = MyWindow;
MyWindow->Create(NULL, L"window");<br />
MyWindow->ShowWindow(m_nCmdShow);<br />
MyWindow->UpdateWindow();<br />
return TRUE;<br />
};
1-) What is happening in m_pMainWnd = MyWindow assignment so window does not close immediately? Is this assignment call some functions in CwinThread class? Or something else?
2-) Also this is very interesting for me and i do not understand why it is so.
I assigned m_pMainWnd MyWindow object that derived from CFrameWnd class so m_pMainWnd holds CFrameWnd object but m_pMainWnd->Create(...) calls Cwnd::Create not CFrameWnd::Create ? Why is it so? How can it be?
Can you please help me to understand this assignment.
I am looking for your answers...
|
|
|
|