24 fstream file(argv[1]);
26 int headLen = atoi(argv[2]);
27 int lineWidth = atoi(argv[3]);
28 double mjdRef = atof(argv[4]);
29 int numLines = atoi(argv[5]);
31 int totalBytes = headLen;
34 char* buf =
new char[lineWidth];
36 double currentTime = 0;
40 while (file.read(buf, lineWidth))
50 currentTime =
reinterpret_cast<double*
>(timeBuf)[0];
52 if (realNumRows >= numLines)
54 if (currentTime + mjdRef > 60000 || currentTime + mjdRef < 10000)
56 if (currentTime + mjdRef > 20000 && currentTime + mjdRef < 50000)
60 if (currentTime > 50000 && currentTime < 60000)
63 reinterpret_cast<double*
>(timeBuf)[0] = currentTime;
64 file.seekp(totalBytes);
73 file.seekp(totalBytes + lineWidth);
77 totalBytes += lineWidth;
86 bool changeDone =
false;
88 if (realNumRows == numLines)
91 while (file.good() && !changeDone)
96 if (
str.substr(0,9) ==
"NAXIS2 =")
100 file.seekp(seeked + 30 - ss.str().size());
101 for (
int i=0;
i<ss.str().size();
i++)
102 file.put(ss.str()[
i]);