int HttpMime::loadMime(const char *pPropertyPath) { FILE *fpMime = fopen(pPropertyPath, "r"); if (fpMime == NULL) { LS_ERROR("[MIME] Cannot load property file: %s", pPropertyPath); return errno; } char pBuf[TEMP_BUF_LEN]; int lineNo = 0; m_pSuffixMap->release_objects(); while (! feof(fpMime)) { lineNo ++ ; if (fgets(pBuf, TEMP_BUF_LEN, fpMime)) { char *p = strchr(pBuf, '#'); if (p) *p = 0; processOneLine(pPropertyPath, pBuf, lineNo); } } fclose(fpMime); return 0; }
int main(int argc, char *argv[]) { FILE *inf; char line[1000]; int i; char *infileName; if (argc != 3) usage(); proteinId = argv[1]; infileName = argv[2]; for (i=0; i<8; i++) previousWord[i] = strdup("n/a"); inf = mustOpen(infileName, "r"); /* skip initial 2 header lines in .rdb format file */ mustGetLine(inf, line, sizeof(line)); mustGetLine(inf, line, sizeof(line)); /* read and process all lines one by one */ while (fgets(line, sizeof(line), inf) != NULL) { *(line + strlen(line) - 1) = '\0'; processOneLine(line); } return(0); }