|
It's not a problem with public or private. You need to define the static variable again in the implementation file (.cpp)
Eg:
yourclass.h:
class yourclass
{
static bool test;
}
yourclass.cpp
bool youclass::test;
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
VuNic wrote: You need to declare the static variable again...
Technically, that's called defining.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
OOPs!
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Thanks
you are right .
|
|
|
|
|
Dear friends, i am currently working on a module which lists the IP address of all the active systems in a LAN. The process continuously runs and updates the IP addresses(in case logged in or log out). I have used timer to update it. Now i need to check if a remote system is logged in or not. So if you know please do tell me what should be done to check if a remote system is logged in.
Thank you(in anticipation)
Shalumalu
|
|
|
|
|
ShaluMalu wrote: So if you know please do tell me what should be done to check if a remote system is logged in.
Is NetServerEnum() of any help?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
client=accept(serv,(struct sockaddr*)&frm,&frmlen);
This line gets the client that connects from a remote machine.
Now how do we know from which machine did that connect? How do we get the machine name or IP address. Is there any function that gets in the SOCKET as input and returns IP address or Name?
----------------------------
286? WOWW!
|
|
|
|
|
_8086 wrote: Now how do we know from which machine did that connect?
client = accept(serv, (struct sockaddr *) &frm, &frmlen);
char *clienthost = inet_ntoa(frm.sin_addr);
int port = ntohs(frm.sin_port);
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks David.
----------------------------
286? WOWW!
|
|
|
|
|
Hello All,
I read strings from file and want to convert that String to int (enum value)
Example:
CString str = "ABCD";
I want output to be:
int i = ABCD;
Is it a valid conversion?? Can it be done? If yes, could you please provide me an example?
Thanks.
|
|
|
|
|
are you serious ???
since when ABCD is an integer ?
unless you have an hexadecimal value maybe ?
please explain your question more, because it is not clear enough to get valuable help
|
|
|
|
|
when I read the file, i get CString token returns "ABCD" with myfile.NextArgument()
I want to convert that CString token to enum value ABCD.
|
|
|
|
|
can you show the definition of your enum please ?
also, show some lines of the file you read
|
|
|
|
|
typedef enum PROP_VALUES
{
PROPULSION,
ENGINES,
MOTORS
DIESEL
};
struct ENG_Data
{
CString name;
int eng_num;
PROP_VALUES mode;
};
ENG_Data eng[10];
File has entries like the following:
CTRL: 1, Vehicle, 23456, PROPULSION
CTRL: 2, Bikes, 12222, MOTORS
etc.
myfile.OpenTextFile(m_File);
while (myfile.GetNextCommandLine())
{
cmd= myfile.Command();
if (cmd== "CTRL")
{
int i = atoi(myfile.NextArgument());
eng[i].name = (myfile.NextArgument());
eng[i].eng_num = atoi(myfile.NextArgument());
eng[i].mode = (myfile.NextArgument())); <-------- This is one I want to convert to integer(enum value)
}
myfile.CloseTextFile(m_File);
|
|
|
|
|
Maximilien gave you the right answer. you cannot do like you asked. you must check using a if/else if series
|
|
|
|
|
Thanks for your comments.
|
|
|
|
|
If str is something like
str = "111";
then try
_atoi() or _ttoi()
|
|
|
|
|
if I understand correctly, you have this in your code :
typedef enum {
ABCD = 0,
EFGH
} SomeEnum;
and when reading a file with the string "ABCD" you want to "map" that string to the corresponding enum value ?
you can do something like :
char* s;
SomeEnum myEnum;
if ( strcmp( s, "ABCD") == 0 )
{
myEnum = ABCD;
}
else if ( strcmp( s, "EFGH") == 0 )
{
myEnum = EFGH;
}
else ...
but, IMO, if can store numbers (the real enum value) instead of a string, then you will only have to load the int and ( maybe) cast it to the enum type.
M.
|
|
|
|
|
|
Hi,
I have done report genaration project in vc++.
I have show some data on the window from database and save that data into file. I just found out that it only crashes when the files are on the desktop.That is when i try to open the file on desktop using CFileOpendialog, my application going to closed.But application work properly in my PC.
|
|
|
|
|
do you really need to repost half an hour after ?
|
|
|
|
|
Come on, tox. He waited 33 whole minutes for a response. If you can't help him within that amount of time, we're gonna have to consider cutting your pay.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Hi,
I have done report genaration project in vc++.
I have show some data on the window from database and save that data into file. I just found out that it only crashes when the files are on the desktop.That is when i try to open the file on desktop using CFileOpendialog, my application going to closed.
But that file placed on any other drives like(c:,d:,..), nothing to worry, it will execute successfully...
|
|
|
|
|
Can you show me the code?
Is the buffer to which you recieve the file path, long enough to hold a maximum of 255 characters?
nave
|
|
|
|