G
Gary Wessle
Hi there
I have a method which returns time_t and another two methods return
double data types and I cann't change that since the library is
provided by Big Bucks Inc. I think time_t is long but I could not
verify that from time.h
using sizeof(type) and numeric_limits<type>::max() tells me that int
and long give the same output.
in a loop, I will be saving the output of the methods to a file which
will be large in size and thus trying to minimize its size if I can.
the file will be in the format;
time_t double double \n
....
the number of records will be 432000 every week the code is run.
to reduce its size. I am suggesting the following.
cast time_t into int just to make sure.
cast the output of the other 2 methods into float since that is only 4
bytes and not 8.
don't use "\n" thus extra work when extracting the data but that is
ok.
the problem:
cast only changes the representation on the data and not its actual
type. so if I do
cout_to_file << static_cast<float> (the out put of double myMthd()),
that will still take 8 bytes and not 4 as expected.
how do I solve this?
many thanks.
I have a method which returns time_t and another two methods return
double data types and I cann't change that since the library is
provided by Big Bucks Inc. I think time_t is long but I could not
verify that from time.h
using sizeof(type) and numeric_limits<type>::max() tells me that int
and long give the same output.
in a loop, I will be saving the output of the methods to a file which
will be large in size and thus trying to minimize its size if I can.
the file will be in the format;
time_t double double \n
....
the number of records will be 432000 every week the code is run.
to reduce its size. I am suggesting the following.
cast time_t into int just to make sure.
cast the output of the other 2 methods into float since that is only 4
bytes and not 8.
don't use "\n" thus extra work when extracting the data but that is
ok.
the problem:
cast only changes the representation on the data and not its actual
type. so if I do
cout_to_file << static_cast<float> (the out put of double myMthd()),
that will still take 8 bytes and not 4 as expected.
how do I solve this?
many thanks.