|
Desmo16 wrote: When i write to a file a number divided by zero
and then i open that file with notepad i found
-1.#IND.
Why not intercept the divide-by-zero error and write 0.0 to the file instead? Would that work, or is 0.0 considered a valid number?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I take it that everything is not preceeded by "string" or "double"? If they are, I would suggest modifying the file format and either use XML or just out the name and then the double values in a delimited file:
Station 1;2.0;1.0;4.5
Station 2;;2.45;9.1
With that type of format, you just load in the line and parse the string by the delimiter (in this case, a ';'). If there is nothing in between 2 consecutive ';'s (or a ';' followed by the end of line), you know that value is invalid.
Avoid divide by zero issues by checking the denominator in your division before doing it.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Scientific software I know prefers to write nan instead of the C++ -1#ind
With VC++, you can use
_fpclass [^] to determine the type (+/. nan, quiet nan, inf). I promote all non-number values to 'nan'.
When reading, you can read a "word" (i.e. everything until the next space), then first check if it is qual to "nan" and handle accordingly.
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
I think that this _fpclass is a nice idea,
but it's not too clear to me how to realize it.
May i write in the ascii file "nan", then load it as
a double and test it with _fpclass() ?
|
|
|
|
|
write (simplest solution) - pseudocode:
if (_finite(x)) write("nan"); else write(x);
(write is your filewriting function)
read accordingly:
string s = read(next_element);
if (s == "nan") { ... it's a nan... }
else x = strtod(s,...);
the actual code depends a lot on what methods and libraries you use.
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
I have created a project in which i have 3 dialog.i need to pass and take the value from one dialog to another.. is it possible??
thanks in advance
|
|
|
|
|
|
Jun Du wrote:
Yes.
Nice
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
There are almost countless ways to do this.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Quite easy in fact...assuming you have the 3 Dialogs decended from an MFC class
<br />
<br />
CDialog1 dlg1;<br />
CDialog2 dlg2;<br />
CDialog3 dlg3;<br />
...<br />
if(dlg1.DoModal())<br />
...
if(dlg2.DoModal())<br />
...
if(dlg3.DoModal())<br />
...
<br />
dlg1.m_iMyValue = dlg2.m_iMyValue = dlg3.m_iMyValue;<br />
dlg2.m_iOtherValue = dlg1.m_iMyValue + dlg3.m_iSomeValue;<br />
dlg3.m_iAnyValue = dlg1.m_iThisValue * dlg2.m_iBigValue;<br />
<br />
Of course, to be truly object oriented, you'd probably add functions to get the information since the data should normally be declared protected/private. At any rate, that's a real simple example of how to do it. I hope that helps, let me know if you need any additional information.
|
|
|
|
|
san_nat wrote: have created a project in which i have 3 dialog.i need to pass and take the value from one dialog to another..
Use WIndow Messaging for same! most easiest way to do so!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Yes you can use from variables in dialogs or you can use from for example if you have two dialog
CMainDialog and ClocalDialog now if you need to a variable in maindialog see
CMainDialog* m_Main = (CMainDialog* )GetParent(); m_Main->variables or functions
whitesky
|
|
|
|
|
Hi all,
Is there anybody able to use National Instruments Measurement Studio ?
I need to plot just a few points (no line) on a plot but i don't know how.
Elsewhere is there a way to do that using MFC ?
Thanx,
Desmo16.
|
|
|
|
|
Desmo16 wrote: Elsewhere is there a way to do that using MFC ?
Yes, you could do it fairly easily with MFC/GDI. Have you used MFC before?
Best,
Jun
|
|
|
|
|
Jun Du wrote:
Yes, you could do it fairly easily with MFC/GDI. Have you used MFC before?
Measurement Studio is far more Convient for drawing graphs and related thing!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Desmo16 wrote: Is there anybody able to use National Instruments Measurement Studio ?
measurement studio has rich documentation present at there site! visit NI.com for more INfo
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Could anyone plz tell me how to ( Programmatically ) terminate / release / kill .... ( whatever ) a dll, so that one program doesn't hold on too the thing the whole time.
Plz
Thanx
Programm3r
|
|
|
|
|
Isn't enough with "FreeLibrary"?
Marc.
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
|
Search for FreeLibrary function in your/online help files.
Marc.
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
if this dll was loaded using LoadLibrary, then FreeLibrary should do the trick.
if this dll was loaded by the exe (the compilation was with the lib) , then when the exe unloads the dll.....
hope this helps
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
Use FreeLibrary function
see MSDN for more information
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
<blink>My Blog | Understanding State Patte
|
|
|
|
|
|
Programm3r wrote: My bad .... Thanx
what?
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
<blink>My Blog | Understanding State Patte
|
|
|
|
|
thanks in advanced
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|