|
jimjim733 wrote: If the button is pressed again I want to close the application. How can I do this safely?
By calling ExitProcess() .
"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
|
|
|
|
|
Or if you want to kill the new application from the one that spawned it, use TerminateProcess().
|
|
|
|
|
I am BATMAN wrote: ...use TerminateProcess().
Which is unsafe.
"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
|
|
|
|
|
I suppose Batman isn't expected to terminate gracefully a process...
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]
|
|
|
|
|
jimjim733 wrote: safely
Define what you mean by 'safe' - that'll help indicate what an appropriate solution is.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I stored the data in structure and placed it into a vector. However i need to upload this data through web service to the server and this happend for every 5 mins(i used a waitable timer).thus i used an array and send the data from vector to an array
LogInfo *Info = new LogInfo [m_vectStruct.size()];
for (int j = 0; j < m_vectStruct.size(); ++j)
{
ThreatInfo[j] = m_vectStruct.at(j);
}
However the data is going beyong 800MB and becoz of this the network is getting blocked.
Thus please let me know how can i send the data from vector to an array even if the size of the data is more than 3GB???
I Even Used the below code but of no use.
copy ( m_vectStruct.begin(), m_vectStruct.end() , &Info );
Please help its bit urgent...
Thanks in Advance
|
|
|
|
|
Instead of using a waitable timer, why can't you choose a limit on the number of elements in the vector and upload it as soon as it hits this limit? Also, what's with copying stuff into an array and all? I don't get the idea.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
brucewayn wrote: this happend for every 5 mins
brucewayn wrote: However the data is going beyong 800MB and becoz of this the network is getting blocked.
Not sure we have the entire picture, but based on that picture there might be a need to send the data in smaller segments rather than sending all of it every 5 minutes.
|
|
|
|
|
brucewayn wrote: thus i used an array and send the data from vector to an array
Does the vector get cleared periodically? If not, then...why bother? Underneath the covers, a vector == an array.
brucewayn wrote: Thus please let me know how can i send the data from vector to an array even if the size of the data is more than 3GB???
For a start with a 64bit OS and 8GB+ of RAM?
Can you give some more information about what you're trying to achieve, what the context is, 'cause from what you've given us, I'm baffled by what you're doing.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Folks, I know we can use unsigned/signed int and char to define our own Boolean type in C. We can either use 0 or 1 to distinguish FALSE or TRUE or use TRUE as anything which is non-zero.
Why can't I use float data type to define my own boolean type?
Can I use the zero and no zero concept using float and define my boolean type using it?
|
|
|
|
|
A custom boolean type? I mean - you are going to have a true , false and then third state, which would signify maybe or dunno state?
Seriously though, why do you need such a thing? If you need it, you already seem to know that you can use an int . I just don't get it.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Basically, I am looking to use only two states TRUE or FALSE, YES or NO anything which is not FALSE will be TRUE, so no intermediate state.
Someone pointed that using float would be wrong. Just looking to know that why it would be wrong.
|
|
|
|
|
So, you can initialize all your boolean variables with true and make sure that unless you set it to false, it would remain true. Am I missing something big?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
kaku_lala wrote: Basically, I am looking to use only two states TRUE or FALSE, YES or NO anything which is not FALSE will be TRUE, so no intermediate state.
kaku_lala wrote: Someone pointed that using float would be wrong. Just looking to know that why it would be wrong.
Quote Selected Text
In any case it is pointless.
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]
|
|
|
|
|
Possibly he need a fuzzy logic [^] variable...
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]
|
|
|
|
|
kaku_lala wrote: Why can't I use float data type to define my own boolean type?
You could. Doesn't this compile?
float f;
if (f) { }
Now, why would you want to? What benefit is there from using a float as a boolean?
There are plenty of flaws as well - as soon as you start doing arithmetic with floats involving numbers that cannot be precisely represented in a float, you're in for trouble.
Consider this short program:
#include <iostream>
int main()
{
float g = 0.0;
while (g < 10.0)
{
g += 0.1;
std::cout << g << std::endl;
}
}
Simple, right? Not entirely - here's part of the output:
7.7
7.79999
7.89999
7.99999
8.09999
8.2
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
kaku_lala wrote: Why can't I use float data type to define my own boolean type?
Can you guess the output ? Try this code;
typedef float FLOATBOOL;
bool func_check_BF(FLOATBOOL x)
{
if (x)
{
cout << x << " is TRUE - FLOATBOOL" << endl;
return true;
}
else
{
cout << x << " is FALSE - FLOATBOOL" << endl;
return false;
}
}
bool func_check(bool x)
{
if (x)
{
cout << x << " is TRUE - bool" << endl;
return true;
}
else
{
cout << x << " is FALSE - bool" << endl;
return false;
}
}
int main(int argc, char* argv[])
{
func_check_BF((FLOATBOOL)0);
func_check_BF((FLOATBOOL)0.1);
func_check_BF((FLOATBOOL)1);
func_check((bool)0);
func_check((bool)0.1);
func_check((bool)1);
return 0;
}
Any way it is pointless! It should be only TRUE or FALSE for a boolean variable.Otherwise your customer may blessed with cocktails from a tea wending machine.
|
|
|
|
|
Hallo,
i have the following problem:
i have an SDI application, in the Test_Doc.cpp i call the function(): OnDlg() which is afx_msg function(), and this function calls another function: OnFontDlg() which is void and defined in another file: Font_Dlg.h and Font_Dlg.cpp, when trying to call the function
OnDlg() i get an error C2352: CFont_Dlg::OnFontDlg illegal call of non-staic function
i searched in google but i could not find any help.
Has anybody an idea to fix this problem?
Thanks in advance.
|
|
|
|
|
You cannot call a class member function like you call a normal function. Either use a class object to invoke that function or make the function as a static member function.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
thanks alot it works have a nice day.
|
|
|
|
|
how are you calling the function?
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
I have to define a directive depending upon the value of an expression.
For Eg:
In the following statement when I change the value of DLEVEL then the STACK value changes correctly as the value of DLEVEL is a constant.
#define DLEVEL 0
#if DLEVEL == 0
#define STACK 100
#else
#define STACK 50
#endif
printf("STACK = %d\n",STACK);
However in the following STACK value changes incorrectly when I change the value of x since the x is not a const expression.
const int x = 0;
#define DLEVEL x
#if DLEVEL == 0
#define STACK 100
#else
#define STACK 50
#endif
printf("STACK = %d\n",STACK);
Anyway to define a directive depending upon the value of an expression ?
RKP
|
|
|
|
|
RKP728 wrote: Anyway to define a directive depending upon the value of an expression ?
No - macros are evaluated before the compiler even sees the code, never mind being evaluated at run-time!
To see the code after macros have been evaluated, use the /P compiler option.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
yes stuart you are correct
macros gets preprocessed before expression compilation
RKP
|
|
|
|
|
Here are two ways that may help you:
1. delayed compile-time decision
#define STACK (STACKX==0?100:50)
...
#define STACKX 12
...
printf("STACK = %d\n",STACK);
2. run-time decision
#define STACK(x) (x==0?100:50)
printf("STACK = %d\n",STACK(12));
|
|
|
|