forked from k-medai/CASPER
-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.c
43 lines (38 loc) · 1.09 KB
/
util.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "util.h"
/*----------------------------------------------------
Check Open File Stream
-----------------------------------------------------*/
void open_inputfile( ifstream &fp, const char *filename ) {
fp.open( filename );
if( fp.fail() ) {
cout << "Error: Cannot open input file (" << filename << ")" << endl;
exit(EXIT_FAILURE);
}
}
/*----------------------------------------------------
Check Output File Stream
-----------------------------------------------------*/
void open_outputfile( ofstream &fp, const string & filename ) {
fp.open( filename.c_str() );
/*
if( fp==NULL ) {
cout << "Error: Cannot open output file (" << filename << ")" << endl;
exit(EXIT_FAILURE);
}
*/
}
/*----------------------------------------------------
Check FASTQ file start from '@'
-----------------------------------------------------*/
void check_firstline( const string &data )
{
if( !data[0]=='@' ) {
cout << "Error: forward file read data " << endl;
exit(EXIT_FAILURE);
}
}
string itoa( const int number ) {
stringstream s;
s << number;
return s.str();
}