|
One solution is the registry.
Kuphryn
|
|
|
|
|
Registry is fine, but not the newest thing under the stars...
For "partially trusted" applications (kind of the .NET sandbox), there's Isolated Storage.
There was also a relatively quick way to serialize a class to an XML file in the Application Data of the current user - which might be the "modern" way.
[edit] damn! I'm just back from the C# forum - for good old MFC it's the registry[/edit]
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
You could always go with the ultra-modern INI file!
|
|
|
|
|
XML files are the best for saving configuration data!
|
|
|
|
|
|
After years of storing information in the registry, we are now standardizing on... ini files! The reason? MUCH lower support costs for our particular niche.
My company sells to schools and our products are typically run in networked situations. School networks
<gross generalization="">
1. Are run by sysadmins who have a poor understanding of their networks.
2. Are EXTREMELY concerned with locking down the system.
3. Often have some truly bizarre policies in place.
4. Often rebuild a standard working environment on every login.
We have found that our customers like being able to edit, copy and move a straight-forward text file and they can usually solve their problems themselves. With our old registry-based solution we spent enormous amounts of time trying to make our system support their (often bizarre) needs and then explaining the solution to them.
Paul Hooper
If you spend your whole life looking over your shoulder, they will get you from the front instead.
|
|
|
|
|
What is the best way to access large arrays of numberic values to use in separate class functions?
Thanks for any help in advance.
|
|
|
|
|
oops! fat fingered numeric.
|
|
|
|
|
Use vectors:
#include <vector>
using namespace std;
vector<int> a;
a.push(100);
a.push(200);
.
.
.
|
|
|
|
|
|
thanks for the reply!
Where would i locate this code so that it is accessible by all functions within a class?
|
|
|
|
|
how to get the registers - REGS in other compilers - in vcpp6.REGS is not even found in the msdn when searched!!
|
|
|
|
|
Try looking up the _asm keyword. If you are trying to connect assembly language code to a higher level language, lookup "calling conventions".
Software Zen: delete this;
|
|
|
|
|
The REGS structure was for 16-bit applications. Check out the _asm keyword as suggested by Gary. With embedded assembly, you can access the registers.
|
|
|
|
|
Hi
I have a set of characters i.e. [a,b] and i have to find out the number of combinations of length 4 i.e.
aaaa,aaab,aaba,abaa,baaa,aabb,abab,abba,baba,bbaa,abbb,babb,bbab,bbba,bbbb
The problem is that
The set can be of any length( n number of characters can be in the set) and words can be of any length( from 1 to n)
How can i find out the number of words of length n formed with the help of n characters ??
Any help will be appreciated
Thanks
|
|
|
|
|
This is a permutation problem. One solution is a loop.
Kuphryn
|
|
|
|
|
If you have n characters available and your word is length w...
The first character in the word could be anyone of the n available.
The second character in the word could be anyone of the n available.
The third character in the word could be anyone of the n available.
.
.
.
The last (w) character in the word could be anyone of the n available.
As each of these characters is independent, the total number of words can be found by
n*n*n*.......*n
or
n^w (n to the power w)
In your example, 2 characters and a word length of 4, the total number = 2^4 or 16 possibilities. You only listed fifteen - you missed baab.
BTW, you really should tell us who you are. I only just noticed that you are anonymous. I probably would not have answered if I had seen earlier.
Paul Hooper
If you spend your whole life looking over your shoulder, they will get you from the front instead.
|
|
|
|
|
Hi!
I recently use CHTMLEditView in vc7 to create a simple html editor. I modify the sample "htmledit" provide in VisualStudio. It switch design mode and navigate mode by the method "SetDesignMode". But when in the navigate mode, i don't know how to implement back and forward buttons just like the IE. I think it maybe very simple, but i don't find the right material describing it.
Any idea?
BTW, do you notice a class about insert table in the sample, but never be used? I think the writer of this sample try to implement a feature of inserting table into html, but fail to achieve it.
|
|
|
|
|
I meet a problem when making a multicast program these days.I first create a multicast receiver program and join a host group, and then i create a multicast sender program to send data to the host group.But the problem is if I send a packet with size larger than 28112 bytes, the receiver would not receiver it and if the size is smaller than 28112 ,it works ok.
I am really confused. Anybody who met similiar problem, please tell me your experience, any information is useful to me.Thanks very much!
To be better, better and better ...
|
|
|
|
|
I have used the hashtable in java but I want to use the same functionality in vc++.
What exactly i want is that I want to use "192.168.2.61"IP's as my keys and Macs "00:50:8D:39:61:E1" as my items. So that I may be able to insert(put) the item(Mac) w.r.t ip(key) in the table and get it back when is needed, so I may be able to manage my routing table.
Please help me.
Reply me soon
|
|
|
|
|
CMapStringToString mYmAcMaP;
mYmAcMaP[_T("192.168.2.61")] = _T("00:50:8D:39:61:E1");
|
|
|
|
|
Hello,
I’m confused about why the following socket code gives me the blue screen of death. The code works when the client is local (on the same machine as the server). When I try the server code with a remote client (on another PC) I always get the BSOD every time after sending a few bytes. The strange thing is that if I put a Sleep command that sleeps for 20 milliseconds before the send command, the server code works. I’m running WIN2000 Professional, Netgear FA311/312 network card and AMD 1.2Ghz CPU.
bool CBlockingSocket::Accept(CBlockingSocket& sConnect, LPSOCKADDR psa)
{
ASSERT(m_hSocket != NULL);
ASSERT(sConnect.m_hSocket == NULL);
int nLengthAddr = sizeof(SOCKADDR);
int iError = 0;
char cErrorMsg[6], strErrorMsg[50];
sConnect.m_hSocket = accept(m_hSocket, psa, &nLengthAddr);
if (sConnect == INVALID_SOCKET)
{
// no exception if the listen was canceled
if ((iError = WSAGetLastError()) != WSAEINTR)
{
cout << "I'm waxing my modem" << endl;
itoa(iError, cErrorMsg, 10);
strcpy(strErrorMsg, "Accept Error: ");
strcat(strErrorMsg, cErrorMsg);
throw strErrorMsg;
}
return FALSE;
}
return TRUE;
}
void CBlockingSocket::Connect(LPCSOCKADDR psa)
{
ASSERT(m_hSocket != NULL);
// should timeout by itself
if (connect(m_hSocket, psa, sizeof(SOCKADDR)) == SOCKET_ERROR)
{
throw "Connect";
}
}
int CBlockingSocket::Write(const char* pch, const int nSize, const int nSecs)
{
int nBytesSent = 0;
int nBytesThisTime = 0;
const char* pch1 = pch;
do
{
nBytesThisTime = Send(pch1, nSize - nBytesSent, nSecs);
nBytesSent += nBytesThisTime;
pch1 += nBytesThisTime;
} while(nBytesSent < nSize);
return nBytesSent;
}
int CBlockingSocket::Send(const char* pch, const int nSize, const int nSecs)
{
ASSERT(m_hSocket != NULL);
// returned value will be less than nSize if client cancels the reading
FD_SET fd = {1, m_hSocket};
TIMEVAL tv = {nSecs, 0};
if (select(0, NULL, &fd, NULL, &tv) == 0)
{
throw "Send timeout";
}
int nBytesSent;
if ((nBytesSent = send(m_hSocket, pch, nSize, 0)) == SOCKET_ERROR)
{
string strError;
char cError[2];
int i = WSAGetLastError();
strError = "Send Error: ";
itoa(i, cError, 10);
strError += cError;
throw strError;
}
return nBytesSent;
}
int main(void)
{
WSADATA wsd;
if (WSAStartup(0x0101, &wsd) != 0)
{
cout << "Unable to start socket\n";
}
CSockAddr saClient;
char* buffer = new char[12];
buffer[11] = '\0';
CBlockingSocket sockListen;
CConnectionSocket sConnect;
CSockAddr saServer(INADDR_ANY, 2112);
sockListen.Create();
sockListen.Bind(saServer);
sockListen.Listen();
strcpy(buffer, "Hello World");
if (!sockListen.Accept(sConnect, saClient))
{
// view or application closed the listing socket
return 0;
}
for (int iii = 0; iii < 100000000; ++iii)
{
sConnect.Write(buffer, 11);
}
}
Any help would be greatly appreciated.
Thanks in advance.
|
|
|
|
|
You need to change the way you setup your socket set to use with select. The second element of the fd_set structure is an array, not a simple value. Use the following:
fd_set fd;
FD_ZERO(&fd);
FD_SET(m_hSocket, &fd);
if(select(...))
...
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I am trying to insert an ActiveX Control using the resource manager. As a quick test I have tried inserting it into the "help" dialog box from a simple hello world app. Once it is inserted however the dialog box will not appear when I select help from the menue. I added an item to the menue to open my own dialog box and the same thing happens, the dialog box just does not appear. It will appear again if I remove the activeX control from the dialog via the resource editor. Does anyone know what I am doing wrong?
Thank you for any comments.
Mardigin
|
|
|
|
|
Do you call AfxOleInit() in InitInstance (MFC), or AtlAxWinInit in Run (WTL) ?
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|