Skip to content
Snippets Groups Projects
Commit a29e816a authored by James Graham's avatar James Graham
Browse files

Changed to fskipo from POSIX - requires gnu extensions with GCC, clang

is fine
parent b2cc72a3
No related branches found
No related tags found
No related merge requests found
project(xtc-length)
if(CMAKE_VERSION VERSION_GREATER "3.1")
set(CMAKE_C_STANDARD 99)
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90")
endif()
add_executable(xtc-length xtc-length.c)
#include <stdio.h>
#include <inttypes.h>
#include <stdint.h>
#include <locale.h>
#include <string.h>
......@@ -33,7 +33,7 @@ int get_xtc_num_frames(const char *filename, int *nframes, int *natoms, float *p
*natoms = u4_from_buffer(header+4);
uint32_t frame_size = u4_from_buffer(header+88); // Read frame size from header
uint32_t skip = (frame_size+3) & ~((uint32_t)3); // Round up to 4 bytes
fseek(xtc, skip, SEEK_CUR); // Skip to next header
fseeko(xtc, skip, SEEK_CUR); // Skip to next header
}
uint32_t ps_tmp = u4_from_buffer(header+12);
memcpy(psec, &ps_tmp, 4);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment