|
The command processor does some bizarre read-ahead stuff which can lead to earlier definitions going crazy.
See help set for information on delayed environment variable substitution - basically, you surround the variable name with ! rather than % .
I'll admit that when I was trying to do something similar, I wrote a C++ program. It's a lot more controllable.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks, Mike! I was able to fix it by using the %% notation (reqd in scripts).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
It's a known issue with the command interp. Need to use %%i instead of %i when including commands in a script.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi People !
I ´m programming an 32 bit application that has to read a series of nunbers from a formated TXT file.
I was thinking about using fscanf but I realized that I need to open the file with fopen , that is an absolete function ...
Well.. I´d like to know if is there another alternative for fscanf , or if I can use fscanf even opening the file with CreateFile. Is there a new function to read a formated file , that is compatible with Createfile ?
Thank you in advande
|
|
|
|
|
|
Sorry !!!
I mean obsolete ...
Humm . I have heard about some people that had problems using it in 32 bit applications ...
|
|
|
|
|
arturapps wrote:
I have heard about some people that had problems using it in 32 bit applications
Which means they were not using it correctly. Being obsolete means that it is not available to use, correct or otherwise.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
arturapps wrote:
I need to open the file with fopen , that is an absolete function ...
What's obsolete about it? Are you using Visual Studio v7.x?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
i don't think fscanf is obsolete...
anyway, if you prefer the "younger" std::cin, you can thus read series of numbers too.
You will have to open a stream associated to your target file, and then do as much as cin as you want...
watch for iostream s in the msdn for details.
TOXCCT >>> GEII power
|
|
|
|
|
If you like, you can use a method other than fopen to open the file, read a line of text, and use sscanf to parse it.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
wasn't sscanf designed to read from strings ? (C-syle strings i heard)...
TOXCCT >>> GEII power
|
|
|
|
|
Sure, but it works just fine. The only problem with sscanf is that it is MUCH easier to shoot yourself in the foot or introduce buffer overruns.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I'm confused. If you use CreateFile to open the file and ReadFile to read from it, you can use sscanf to parse the string you read.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I am developing software for a startup. However, I am not complete sure that I am developing it in the right language. We are currently using C#. The algorithm we are using to solve construction problems can have over 2,000,000 attributes. DO you think it would be better to code it in C++...My gut tells me yes..because I will be able to run linux clustered servers as opposed to windows servers.......
What do you think....Hong Kong Expat....http://sterlingwright.blogspot.com
|
|
|
|
|
Yes use C++ - C#'s advantage is that is highly geared towards the web. Number crunching is where C++ has a clear advantage, plus if you write it with non-MFC libraries it is portable
|
|
|
|
|
I think that if I'd known you'd posted this question all over the site, I would not have answered.
One area where C++ might give you an advantage is the STL, which C# does not have ( obviously ).
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian Graus wrote:
I think that if I'd known you'd posted this question all over the site, I would not have answered.
I know the point you were trying to make, but I found this post in only one other forum. What other places was it posted to?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hello everyone,
I was wondering if there was a way to calculate the log2 of a number. I know there are functions for calculating the ln, log and log10, but don't see one for log2...maybe I'm missing it or there's a way to calc it using one of the other functions? Thanks!
"It seems that we're getting to the bottom of the barrel of squirrels." - my boss
|
|
|
|
|
Logarithms in different bases can be done using the formula
logy x = logz x / logz y
So you can use the log or log10 function to produce an approximate log2 function:
double log2(double val)
{
return log(val) / log(2.0);
}
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Argh, beat me to it! You must have posted that while I was in the process of replying.
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
Perfect! Thanks so much!
"It seems that we're getting to the bottom of the barrel of squirrels." - my boss
|
|
|
|
|
Use the Magic Log Forumla:
Logb x = Loga x/Loga b
A funcion that can get an arbitrary log:
double MyLog(double base, double x)
{
return log10(x) / log10(base);
}
...
double a = MyLog(2, 16);
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
just a curiosity and "personal culture" question...
what should we need a Base-2 log for ??
very thank you
TOXCCT >>> GEII power
|
|
|
|
|
A whole world of it:
Check on google log neperien
In breif:
Solving mathematical equations
Mathematical modeling of the movement of protons
Spatial Interpolation,
Mechanical modeling
Probability and statistics ....
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
wow woww stop it man, did you read my post ???
i didn't ask for log neperien (which is a Base-e log), but the need for having a log2 one !!!!
TOXCCT >>> GEII power
|
|
|
|