J
Josh Wilson
OK, somewhat new to C, have searched the group and haven't found an
answer that has fixed my problem, so I am just going to try posting
it.
I am taking really large image files(128x128x35) and turning them into
float, short, double, etc. files, writing them to an array in sections
(so that the machine is working w/ smaller arrays), changing or
evaluating the pixel values, and them writing them out. Doing this
before, I could only find out information as I was doing the
processing, now I want to evaluate all the pixel information, and then
do the manipulations. So, I have a do-while w/ an fread, which
procedes as long as (feof(stdin) == 0)... (in that loop I collected my
info, min., max., etc.) Now, I want to go back and do the whole thing
over as before, putting the values into the array and manipulate them,
so I just clearerr(stdin) and it should be willing to read the file
stream all over again, right?
if(feof(stdin)) clearerr(stdin);
iaccum = 0;
{
if (intype == FLOAT) {
fread(floatarray,4,INDIM,stdin);
istat= fread(floatarray,4,INDIM,stdin);
iaccum+=istat;
for (i=0; i<istat; i++){
dfloatarray = (double) floatarray;
}
}}
Putting in test print outs before, "iaccum+=stat" tells me istat is
still 0, but it should be around 32000. So for my fread function,
floatarray was initialized w/ a size of [INDIM], I'm writing in floats
4 bytes long, there are INDIM items in the array, and stdin has been
cleared... any thoughts why istat isn't changing?
Thanks all for your time!
JMW
answer that has fixed my problem, so I am just going to try posting
it.
I am taking really large image files(128x128x35) and turning them into
float, short, double, etc. files, writing them to an array in sections
(so that the machine is working w/ smaller arrays), changing or
evaluating the pixel values, and them writing them out. Doing this
before, I could only find out information as I was doing the
processing, now I want to evaluate all the pixel information, and then
do the manipulations. So, I have a do-while w/ an fread, which
procedes as long as (feof(stdin) == 0)... (in that loop I collected my
info, min., max., etc.) Now, I want to go back and do the whole thing
over as before, putting the values into the array and manipulate them,
so I just clearerr(stdin) and it should be willing to read the file
stream all over again, right?
if(feof(stdin)) clearerr(stdin);
iaccum = 0;
{
if (intype == FLOAT) {
fread(floatarray,4,INDIM,stdin);
istat= fread(floatarray,4,INDIM,stdin);
iaccum+=istat;
for (i=0; i<istat; i++){
dfloatarray = (double) floatarray;
}
}}
Putting in test print outs before, "iaccum+=stat" tells me istat is
still 0, but it should be around 32000. So for my fread function,
floatarray was initialized w/ a size of [INDIM], I'm writing in floats
4 bytes long, there are INDIM items in the array, and stdin has been
cleared... any thoughts why istat isn't changing?
Thanks all for your time!
JMW