我正在尝试获取文本文件(扩展名为.annotation但仍为文本文件)的列表,并将它们合并到一个文件中。我还想用原始文件名创建一个新列,以便以后可以按文件名对表进行排序。
我有一个看起来像这样的文件列表-
const long size = 8294400;
char firstPart[14] = "3412345";
char secondPart[40] = "daffda";
char *thirdPart = new char[size];
sprintf_s(thirdPart, size, "Test TEst tset ... and other symbols");
BYTE *pFirstPart = reinterpret_cast<BYTE*>(&firstPart);
BYTE *pSecondPart = reinterpret_cast<BYTE*>(&secondPart);
BYTE *pThirdPart = reinterpret_cast<BYTE*>(&thirdPart);
BYTE *combined = new BYTE[(size + 14 + 40)];
memcpy(combined, pFirstPart, 14);
memcpy(combined + 14, pSecondPart, 40);
memcpy(combined + 14 + 40, pThirdPart, size);
我希望新文件看起来像这样-
> read.table("Sample2-1_nucleotideRate.annotation")
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
1 pJW316-17_beforeNGS non-coding 29 29 G A 0.9657791941 NA NA <NA>
2 pJW316-17_beforeNGS non-coding 54 299 A G 0.0064375000 NA NA <NA>
3 pJW316-17_beforeNGS non-coding 64 349 T C 0.0111019737 NA NA <NA>
4 pJW316-17_beforeNGS nsps 85 644 A G 0.0044375000 9 3 synonymous>K