After some searches I found out I could use the formula: filesize = ((xdim*ydim*zdim)*(datatype/8))+ offset Now I need a way to determine the filesize: what is the best way?
THanks!
Hi!
Image files in raw format can have different pixel storage length (1bit 8bit 16bit, unsigned 8bit etc) WHat is the best way to determine in C++ the type from the file?
Thanks!
Actually I tried with some other data and now I am getting the same size in and out. There must have been something strange with the file itself (extra chunk of info written?)
Coming back to the format itself 3 x 2 byte (big endian) for the header what does :
lenx = hi*256+lo;
and
lo =...
could it be the type of the data I export? When I import it I convert the data to (char*) in file.read((char*)pixels,lenx*leny*lenz) (the input code I wrote an old version now I cast with (char*))
As I said before pixels are declared as GluByte
when I write the data to disk I cast the data with...
Thanks Salem,
I did that and got the same size. it is certainly something in
file.write(reinterpret_cast <char*> (pixels),lenx * leny * lenz);
pixels are of type GLuByte.
RE web reference this format is known as "virvo" .rvf see...
Hi!
Following on my previous post: http://www.tek-tips.com/viewthread.cfm?qid=982641&page=1
I have a read function like this:
/* open file */
fstream file (filename, ios::in | ios::binary);
if (!file)
{
PRINT_ERROR("Cannot open file (%s)\n",filename);
}
file.seekg (0, ios::beg)...
PHV why are you so angry?
Anyways I did the following script based on Columb's:
#!/usr/bin/ksh
#create usersnamelist
ls -l /users | awk '{print $3}' | sort -u > /tmp/usernamelist
# process list to get real life name
for u in $(cat /tmp/usernamelist)
do
echo "$u is in real life \c"...
I can use /etc/password
I need something like that but this gives syntax error
#!/usr/bin/csh
for u in $(cat usernamelist)
do
echo $u is in real life finger -m $u | awk '{ if (NR==1) {print $7 $8} }'
done >> userlistwithfullnames
Hi!
I have a file which contains a list if usernames and I would like to get a new file with columns like
"username" "In real life" (output from finger -m "username")
Many thanks!
so you are saying that using
file.read( reinterpret_cast<char*>( pixels ), lenx * leny * lenz);
is better than
file.read( (char*) pixels , lenx * leny * lenz);
then?
Salem,
Thanks for your explanation re void* in C it is clear now.
I noticed that by casting with (char*) works equally well. no need for reinterpret_cast then?
Thanks Salem this has solved one problem. By the way why do we need to use reinterpret_cast in C++ not in C?
My other problem is that hi and lo variables are declared char but should be unsigned char (I get lenx = -128) Do I need to use reintepret_cast as well for the first few reads
like...
that's correct sorry for not mentioning it but the error indeed points to that line file.read(pixels,lenx * leny * lenz); I found many examples using similar statements but in C using fread, since I write in C++ I thought I would use read instead...
Hi!
I have a file which contains a list of files to be deleted.
What simple command should I use with that file as input to delete all the files listed in one go?
I tried rm -f `cat /tmp/filename` but that does not work
Many thanks,
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.