Add ::tell().
authorCarl Hetherington <cth@carlh.net>
Fri, 15 Apr 2022 20:33:43 +0000 (22:33 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 5 May 2022 19:46:30 +0000 (21:46 +0200)
src/file.cc
src/file.h

index 74db83965e1fa8d89043ef6135f4cd13eb791cf1..8ab5029300df229f04a0b8b97f288c320be51d5e 100644 (file)
@@ -175,6 +175,27 @@ File::seek(int64_t offset, int whence)
 }
 
 
+int64_t
+File::tell()
+{
+       DCP_ASSERT(_file);
+#ifdef LIBDCP_WINDOWS
+       return _ftelli64(_file);
+#else
+       return ftell(_file);
+#endif
+}
+
+
+
+int
+File::error ()
+{
+       DCP_ASSERT(_file);
+       return ferror(_file);
+}
+
+
 /** Windows can't "by default" cope with paths longer than 260 characters, so if you pass such a path to
  *  any boost::filesystem method it will fail.  There is a "fix" for this, which is to prepend
  *  the string \\?\ to the path.  This will make it work, so long as:
index ec13fc8287477fdbb9fb1cb8b7217c94d7464fda..037251c10ee76debfe30f8df649b3178e1a20cdd 100644 (file)
@@ -73,6 +73,10 @@ public:
        char *gets(char *s, int size);
        /** fseek/fseeki64 wrapper */
        int seek(int64_t offset, int whence);
+       /** ftell/ftelli64 wrapper */
+       int64_t tell();
+       /** ferror wrapper */
+       int error();
 
        void checked_write(void const * ptr, size_t size);
        void checked_read(void* ptr, size_t size);