Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: fabien
  • Order by date
  1. fabien

    Raw pixel storage

    THanks Salem, Something like: // obtaining file size #include <iostream.h> #include <fstream.h> const char * filename = "example.txt"; int main () { long l,m; ifstream file (filename, ios::in|ios::binary); l = file.tellg(); file.seekg (0, ios::end); m = file.tellg()...
  2. fabien

    Raw pixel storage

    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!
  3. fabien

    Raw pixel storage

    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!
  4. fabien

    Binary read write problem

    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 =...
  5. fabien

    Binary read write problem

    no same result.
  6. fabien

    Binary read write problem

    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...
  7. fabien

    Binary read write problem

    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...
  8. fabien

    Binary read write problem

    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)...
  9. fabien

    finger and usernames

    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"...
  10. fabien

    finger and usernames

    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
  11. fabien

    finger and usernames

    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!
  12. fabien

    GLubyte and read problem

    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?
  13. fabien

    GLubyte and read problem

    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?
  14. fabien

    GLubyte and read problem

    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...
  15. fabien

    GLubyte and read problem

    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...
  16. fabien

    GLubyte and read problem

    no I do have Glubyte *pixels in .h
  17. fabien

    GLubyte and read problem

    Hi! I have the following code /* open file */ fstream file (filename, ios::in | ios::binary); if (!file) { PRINT_ERROR("Cannot open file (%s)\n",filename); } file.seekg (0, ios::beg); /* read dimensions */ file.read(&hi,1); file.read(&lo,1); lenx = hi*256+lo...
  18. fabien

    Delete files from list

    Columb, I tried ksh on Sun Solaris and it worked like you said. I was using csh. What would be the csh version then? Cheers!
  19. fabien

    Delete files from list

    this does not work I get a variable syntax error
  20. fabien

    Delete files from list

    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,

Part and Inventory Search

Back
Top