The "bad quality of screenshots" is due to your bad choice of jpg (a "lossy" format) over png (a "lossless" format). jpg is for natural scenes. png is for images with lots of pixels of exactly the same color.
Post the output of the following program after setting FILENAME to the name of your file. I'm assuming both the file and your machine are little endian, which is likely. If not, it will give evidence of that. Do the 10 values printed at the end match what you expect?
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#define FILENAME "test.tdms"
#define kTocMetaData (1L<<1)
#define kTocRawData (1L<<3)
#define kTocDAQmxRawData (1L<<7)
#define kTocInterleavedData (1L<<5)
#define kTocBigEndian (1L<<6)
#define kTocNewObjList (1L<<2)
int main()
{
FILE *f = fopen(FILENAME, "rb");
if (!f)
{
perror("Cannot open file");
exit(EXIT_FAILURE);
}
fseek(f, 0, SEEK_END);
printf("Filesize: %ld\n", ftell(f));
rewind(f);
char tag[5] = {0};
fread(tag, 4, 1, f);
if (strcmp(tag, "TDSm") != 0)
{
fprintf(stderr, "Not a TDMS file!\n");
exit(EXIT_FAILURE);
}
uint32_t toc;
fread(&toc, sizeof toc, 1, f);
printf("ToC:\n");
if (toc & kTocMetaData) printf(" MetaData\n");
if (toc & kTocRawData) printf(" RawData\n");
if (toc & kTocDAQmxRawData) printf(" DAQmxRawData\n");
if (toc & kTocInterleavedData) printf(" InterleavedData\n");
if (toc & kTocBigEndian) printf(" BigEndian\n");
if (toc & kTocNewObjList) printf(" NewObjList\n");
uint32_t version;
fread(&version, sizeof version, 1, f);
printf("version: ");
if (version == 4713) printf("2.0\n");
else if (version == 4712) printf("1.0\n");
else printf("%" PRIu32 "\n", version);
uint64_t segLen;
fread(&segLen, sizeof segLen, 1, f);
printf("segLen: %" PRIu64 "\n", segLen);
uint64_t metaLen;
fread(&metaLen, sizeof metaLen, 1, f);
printf("metaLen: %" PRIu64 "\n", metaLen);
uint32_t numObjs;
fread(&numObjs, sizeof numObjs, 1, f);
printf("numObjs: %" PRIu32 "\n", numObjs);
fseek(f, metaLen - sizeof numObjs, SEEK_CUR);
for (int i = 0; i < 10; ++i)
{
double d;
fread(&d, sizeof d, 1, f);
printf("%.8f\n", d);
}
return 0;
}