forked from NicoleJAVA/Vector-Space-Model
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doctxtname.cpp
73 lines (50 loc) · 1.92 KB
/
doctxtname.cpp
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/****************** Ver. 26 - doctxtname.cpp*******************
1.)
************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <strings.h>
#include <unistd.h>
#include <ctype.h>
#define TXT_NAME_LEN 100
#define PLEASE_SET_PATH 1
// if create_txtTitle() receives 1,then create different directory
#define DONOT_SET_PATH 0
// if create_txtTitle() receives 0,then the result txt file is in same dir.
using namespace std;
std::string create_txtTitle( int titleNumericPart, int setPathOpt )
{
// titleNumericPart is the numeric part in the txt file name
// eg, '28' of "28.txt"
FILE * newsFile;
FILE * stemmingFile;
FILE * stemmingResultFile;
FILE * vectorFile;
//std::string num_newsSourceTitle; // const char * num_newsSourceTitle;
//std::string num_stemResultTitle; // const char * num_stemResultTitle;
//std::string num_vectorTitle; // const char * num_vectorTitle;
std::string newsSourceTitle ; // const char * newsSourceTitle;
std::string stemResultTitle ; // const char * stemResultTitle;
std::string vectorTitle ; // const char * vectorTitle;
std::string txtSuffixTitle = ".txt" ;
std::string prefixPath = "C:\\Users\\Sony\\Desktop\\Nicole\\IR\\IR-HW2\\vector\\" ;
// the prefix path nameOfDirectory
char titleBuf[ TXT_NAME_LEN ];
if( setPathOpt == PLEASE_SET_PATH ){
snprintf( titleBuf, TXT_NAME_LEN, "%d%s", titleNumericPart, txtSuffixTitle.c_str() );
} // end-1-if
else if( setPathOpt == DONOT_SET_PATH ){
snprintf( titleBuf, TXT_NAME_LEN, "%s%d%s", prefixPath.c_str(), titleNumericPart, txtSuffixTitle.c_str() );
} // end-1-if-else-if
newsSourceTitle = titleBuf;
return newsSourceTitle ;
} // End - create_TxtTitle( ).
/**********************************************************************/
int main4()
{
std::string lala ;
lala = create_txtTitle( 33, 1 );
puts( lala.c_str() );
system("PAUSE");
}