STIOC_READ_POSITION

This IOCTL command returns the block ID of the current position of the tape. The block ID returned from this command can be used with the STIOC_LOCATE command to set the position of the tape.

An example of the STIOC_READ_POSITION command is
#include <sys/Atape.h>

  unsigned int current_blockid;

  /* read current tape position */
  if (ioctl(tapefd,STIOC_READ_POSITION,&current_blockid)<0)
    {
    printf("IOCTL failure. errno=%d"n,errno);
    exit(1);
    }

  /* restore current tape position */
  if (ioctl(tapefd,STIOC_LOCATE,current_blockid)<0)
    {
    printf("IOCTL failure. errno=%d"n,errno);
    exit(1);
    }