DB_lseek

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Russell
Posts: 7
Joined: Fri, 2016-08-26, 16:07

DB_lseek

#1 Post by Russell »

Hi. I'm new to dcmtk361.
In dcmqrdbi.cc function DB_IdxAdd, there is a call to
[481] DB_lseek (phandle -> pidx, (long) SIZEOF_STUDYDESC, SEEK_SET) ;
but the return value pos is not used. And all 3 parameters are by values.
So, what is the purpose of this function?

J. Riesmeier
DCMTK Developer
Posts: 2503
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: DB_lseek

#2 Post by J. Riesmeier »

Did you read the comment that is associated with DB_lseek()?

Code: Select all

/******************************
 *      Seek to a file position and do error checking
 *
 * Motivation:
 * We have had situations during demonstrations where size of the DB index file
 * has exploded.  It seems that a record is being written to a position
 * way past the end of file.
 * This seek function does some sanity error checking to try to identify
 * the problem.
 */
The main purpose of this function is error checking and logging (if there is something the user should be aware of).

Russell
Posts: 7
Joined: Fri, 2016-08-26, 16:07

Re: DB_lseek

#3 Post by Russell »

Dear J. Riesmeier:
Thank you for the quick reply.
I'm trying to access the database through index.dat.
If DB_lseek is only for error checking, is there a
better function I should be using to read an
arbitrary element of the database?

J. Riesmeier
DCMTK Developer
Posts: 2503
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: DB_lseek

#4 Post by J. Riesmeier »

Sorry for being somewhat imprecise in my previous posting. Of course, the call of lseek() is the main purpose of DB_lseek()... but the rest of the function is error checking and logging. Don't ask me why the return value of DB_lseek() is never checked. This code is about 23 years old and has been implemented for demonstration purposes only (e.g. shown at RSNA '93).

Post Reply

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot] and 1 guest