📄 test.cpp
字号:
// Test.cpp : Defines the entry point for the console application.
//
// test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "..\\Word.h"
#include <stdio.h>
#include <string.h>
#pragma comment(lib, "..\\debug\\Word.lib")
#define MAX_CHAR 35500
#define MAX_PATH 256
int findStr(char *array,int len,char des)
{
for(int i=0;i<len;i++)
{
if(array[i]==des) return i;
}
return -1;
}
void deleteStr(char *array,int len,int a)
{
for(int i=a;i<len;i++)
{
array[i]=array[i+1];
}
}
int main(int argc, char* argv[])
{
char *m_result;
bool m_bDisable=IsDataExists();
if(!m_bDisable)
{
printf("No Data Dictionay!\n");
return -1;
}
//读取文本
char content[MAX_CHAR]="";
char sSourceFile[MAX_PATH]=".\\word.txt";
FILE *fpSource;
char *sParagraph;
sParagraph=new char[4*1024];
if((fpSource=fopen(sSourceFile,"rt"))==NULL)
{
printf("No file!\n");
return -1;
}
while(!feof(fpSource))
{
if(fgets(sParagraph,4*1024,fpSource)==0)
continue;
strcat(content,sParagraph);
}
fclose(fpSource);
//读完
//清除回车
int i=findStr(content,strlen(content),10);
while(i!=-1)
{
deleteStr(content,strlen(content),i);
i=findStr(content,strlen(content),10);
}
//分词
m_result=RunFenci(content);
printf("%s\n",m_result);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -