P
PeterOut
If you have measured and found that for your work this is the case, then
it is a valid reason for using float rather than double. Just remember
that this is not the case for all hardware or all programs on some
specific pieces of hardware. Also remember that double normally supports
a larger range than float, not just greater precision.
That's good to know. Thanks. However, the range offered by single
precision floats is more than adequate for my current application.
Also, I am looking to make the program transferable across a range of
hardware and operating systems.
The comment about strtol instead of atoi is still valid, because that is
about the ability to detect and handle input errors.
If using multithreading, or you might go back to it in the future, then
that is an even bigger reason not to use strtok. However, yes,
multithreading does give you a number of additional headaches such as
deadlock if you are not experienced (or even if you are) so you should
only use threads if you have a real reason to do so.
Yes. Thank you for your help. And thank you to everyone for their
help with this problem. I have combined advice and now have the
following code.
ASSERT(AfxCheckMemory());
{
float fMean;
int lX, lY, lLastX = fppPlane->iColumns-1, lLastY = fppPlane-
char csBuffer[32], * pEnd;iRows-1;
do
{
if (!fgets(csBuffer, 32, fpFile)) break;
lX=strtol( csBuffer, &pEnd, 10 );
lY=strtol( pEnd, &pEnd, 10 );
fMean=(float)strtod( pEnd, &pEnd );
fppPlane->Data[lY][lX] = fMean;
} while (lX < lLastX || lY < lLastY);
}
Threads are off topic here. There is I believe a group specifically for
threads, and there are lots of platform specific groups.
I see your point. I have found now a newsgroup about threads.
However, when I started this thread I wist not whence cameth the
source of the hang. I had never heard of deadlocks and knew very
little about multithreading. That problem became more apparent after
I had started the thread.
Thanks,
Peter.