|
Hi to All,
Could anyone please help me choosing the best STL container to Hold a table (DB table)...
Thanks in advance,
-----------------------------
I am a beginner
|
|
|
|
|
That depends on your need
well my suggestions are:-
I think stl map [^] will be very well suited, if you have a lot searching operations.
Since it is DB table, i think it may be need to have a lot of searching.
But if you have add a lot element and no need for searching then list will be better [^].
Величие не Бога может быть недооценена.
|
|
|
|
|
thanks,
Now, after reading from database I need to put the data of a small table in a file system...please provide some hints to do that...
-----------------------------
I am a beginner
|
|
|
|
|
I'm sure it's not the answer you wanted, but It depends upon your data. It also depends upon how you want to use that data. Start by having a look at something that describes the STL Container types and see if it gives any clues. Is there a reason why you want to put the data in a container?
|
|
|
|
|
I got my answer, depending on the need i guess i will go for map
thanks,
Now, after reading from database I need to put the data of a small table in a file system...please provide some hints to do that...
-----------------------------
I am a beginner
|
|
|
|
|
It really depends on how you want to access table items.
Yuo may, for instance use a vector of struct , where each struct contains one row.
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]
|
|
|
|
|
Often you will have to combine multiple containers as per your requirements. For example to create a 2D array you can use a vector or vectors
vector< vector<int> > a;
|
|
|
|
|
Hi all,
I have a problem with sockets inside a thread: it seems the socket object is not working inside the thread.
I'm using a Socket library found on the net and the "socket.h" library from windows.
This code works:
<br />
SocketClient s(ServerAdress, ServerPort);<br />
s.SendLine("aaa");<br />
while (1) <br />
{<br />
string l = s.ReceiveLine();<br />
if (l.empty()) break;<br />
cout << l;<br />
cout.flush();<br />
}<br />
Now I'm trying to do the same thing in a thread... I have a function:
<br />
void Answer(void* param) <br />
{ <br />
SocketClient* ps = (SocketClient*)param;<br />
ps->SendLine("GET / HTTP/1.0");<br />
ps->SendLine("Host: www.google.com");<br />
ps->SendLine("");<br />
<br />
while (1) <br />
{<br />
string l = ps->ReceiveLine();<br />
if (l.empty()) break;<br />
cout << l;<br />
cout.flush();<br />
}<br />
delete ps;<br />
} <br />
And I call it in this way:
<br />
_beginthread(Answer, 0, &s);<br />
All is compiling fine, but then the Socket inside the thread seems to be useless, it doesn't do nothing.
Can anyone explain me how to pass object between threads?
Is there a possibility to pass them without pointers?
I'm quite new in C++ and I found nothing on the net so far.
Thanks!
gianca
|
|
|
|
|
why you think that, thread is useless?
You can pass a object as static object instead of pointer, but remember that it can modified from any thread.
Just refer this article [^]
It is correct to send object as pointer to a thread, but always check carefully on delete. Ensure that it should be deleted only after exit of thread.
Величие не Бога может быть недооценена.
modified on Wednesday, December 16, 2009 6:23 AM
|
|
|
|
|
Is is possible to changed the dll version according to our need.
Currently we get dll version as
<releaseversion> . <majorversion> . <minorversion> . <buildversion>
e.g. 7.1.0.256
Can we change it for our convinience. ?? Let say I want to append some text after version is it possible..??
|
|
|
|
|
You can modify the version by editing the Version section in your DLL project's resource file.
|
|
|
|
|
|
Hi,
I am creating a dialog in which I have to use the Spin control.Firstly I am code for the very first time in MFC.
I have created the dialog and drag dropped the controls on it.
I have taken the Edit control and on its right side I have placed the Spin control.
Please tell me that how I will attach the two controls and what are the property setting to be done in both the control.
Thanks
|
|
|
|
|
Dear friend, i think it will better if you try a hand with the book "Programming Windows with MFC(Jeff prosise)" [^].
The properties you need depends on your requirement, by default some properties are set.
Величие не Бога может быть недооценена.
|
|
|
|
|
Thanks Adam for your reply
Regarding properties I want to is that "Can we do it by setting the property or we have to do it by programming."
|
|
|
|
|
It depends on your need, if you want to set at run time then surely depend on APIs.
else you can set some properties are default.
Величие не Бога может быть недооценена.
|
|
|
|
|
I want to set it through properties.I have done with all the other part by the help of Rajeesh. Can u please tell me how to set the range
|
|
|
|
|
For a spin control, for setting range property you have depend on CSpinButtonCtrl::SetRange() [^] function itself.
Величие не Бога может быть недооценена.
|
|
|
|
|
You can set 'Auto Buddy' property of the spin control to True. This property will automatically attach spin control to the pervious window (editbox in this case) in z-order. You may have to set the 'Set Buddy Integer' property to True as well.
|
|
|
|
|
I have made the Auto Buddy property of spin control as true and also set the Set Buddy Integer as true.
I didn't get "in z-order"
Is there any changes to be done in the properties of edit box
|
|
|
|
|
You will have to make sure that edit box comes before the spin control in tab order. You can open the dialog in resource view and press Ctrl+D to make sure that the tab order is correct.
|
|
|
|
|
I made the tab order as u said.One more question can we give the range say for example 0 - 40 in the edit box which can be incremented or decremented by the spin control (by clicking upward and downward arrow).If yes then where to put it.
Thanks
|
|
|
|
|
Thanks,
I did the same.
Now please tell me how set the range
|
|
|
|
|
|
Hello everyone !
I want to find some files in the whole disk drive , the code like this :
void C***Dlg::EmuFiles(CString strPath, CString strType)
{
WIN32_FIND_DATA data;
CString csPath(strPath);
csPath = csPath + "\\*." +strType;
HANDLE handle = FindFirstFile((LPCSTR)csPath,&data);
BOOL ret = (BOOL)handle;
while(ret)
{
if(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if(data.cFileName[0] != '.')
{
csPath = strPath;
csPath +="\\";
csPath += data.cFileName;
EmuFiles(csPath,strType);
}
}
else
{
csPath = strPath;
csPath +="\\";
csPath += data.cFileName;
m_ListBox.InsertString(nCount,csPath);
m_ListBox.SetCurSel(nCount);
m_nTotal = nCount;
UpdateData(FALSE);
nCount ++;
}
ret = FindNextFile(handle,&data);
}
FindClose(handle);
}
when I use EmuFiles("C:\WINDOWS","exe"), it can be found.
but if I use EmuFiles("C:","exe"),it can't be found as more.
how to set the WIN32_FIND_DATA's parameters to find whole disk?
|
|
|
|