Board index » cppbuilder » Re: array -->> more help - >> explanation

Re: array -->> more help - >> explanation


2003-10-29 06:05:14 AM
cppbuilder20
Ok, Ed -- sorry about the confusion. My point was that your
code was running and mine was not -- on the Borland compiler. I tried it on a GNU compiler because I was convinced that an alien was in my computer. Because it ran on that compiler, I was even more sure something other than my bad coding was
causing the trouble. That's why I sent the outside code -- you
said it had to be something else.
Anyway, I changed all of the print statements as you suggested.
That is in fact the culprit. Why, I have no idea. I'm glad you
said something. One more question: Why are you else statements
nested?
Thanks a bunch. I am saved.
Cory
 
 

Re:Re: array -->> more help - >> explanation

My else statements were nested because 1-I like to use only one return
statement in a function so 2-with only one return statement the code
required it.
The code went something like this, so if you don't write to a file that
failed to open, the nested else is inherent to how it was written:
if (the first file didn't open)
complain
else
{
compute and write to the first file
close the first file
if (the second file didn't open)
complain
else
{
compute and write to the second file
close the second file
}
}
I was puzzled by something else in your code. The format statements used in
the fprintf didn't look right but those format statements have a lot of
specs so maybe it's just something I haven't used.
I see specs like this "%-d\t%-f"
The \t is of course a tab. A %d and %f respectively are for decimal and
float. The thing which gets to me is the minus sign. For instance "%-8d"
means to write the number as 8 wide padded on the right with spaces instead
of padding with spaces on the left. What I have not seen is "%-d" where
there is no number specifying the width. However it seems to work.
The comment about the GNU compiler is that I've little ability to help you
with that, but there are other newsgroups over on Usenet where people
knowledgable of it can be found.
Quote
Thanks a bunch. I am saved.
I like hearing that something I did helped - thanks!
. Ed
Quote
Cory wrote in message
news:3f9ef62a$ XXXX@XXXXX.COM ...

Ok, Ed -- sorry about the confusion. My point was that
your code was running and mine was not -- on the Borland
compiler. I tried it on a GNU compiler because I was
convinced that an alien was in my computer. Because it
ran on that compiler, I was even more sure something other
than my bad coding was causing the trouble. That's why
I sent the outside code -- you said it had to be something else.

Anyway, I changed all of the print statements as you
suggested. That is in fact the culprit. Why, I have no idea. I'm
glad you said something. One more question: Why are you
else statements nested?

Thanks a bunch. I am saved.