rewind_nat.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*!
  2. \file lib/vector/Vlib/rewind.c
  3. \brief Vector library - rewind data (native format)
  4. Higher level functions for reading/writing/manipulating vectors.
  5. (C) 2001-2009, 2011-2012 by the GRASS Development Team
  6. This program is free software under the GNU General Public License
  7. (>=v2). Read the file COPYING that comes with GRASS for details.
  8. \author Original author CERL, probably Dave Gerdes or Mike Higgins.
  9. \author Update to GRASS 5.7 Radim Blazek and David D. Gray.
  10. */
  11. #include <grass/vector.h>
  12. /*! \brief Rewind vector map to cause reads to start at beginning on
  13. non-topological level (level 1) - native format - internal use only
  14. \param Map pointer to Map_info struct
  15. \return 0 on success
  16. \return -1 on error
  17. */
  18. int V1_rewind_nat(struct Map_info *Map)
  19. {
  20. return dig_fseek(&(Map->dig_fp), Map->head.head_size, SEEK_SET);
  21. }
  22. /*! \brief Rewind vector map to cause reads to start at beginning on
  23. topological level (level 2) - native format - internal use only
  24. \param Map pointer to Map_info struct
  25. \return 0 on success
  26. \return -1 on error
  27. */
  28. int V2_rewind_nat(struct Map_info *Map)
  29. {
  30. Map->next_line = 1;
  31. return V1_rewind_nat(Map); /* make sure level 1 reads are reset too */
  32. }