File: test.cpp

package info (click to toggle)
sdcv 0.3.4-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,644 kB
  • ctags: 1,207
  • sloc: sh: 9,235; ansic: 7,803; cpp: 2,613; makefile: 485; yacc: 316; sed: 16
file content (32 lines) | stat: -rw-r--r-- 788 bytes parent folder | download
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
#include <cstdlib>
#include <string>

#include "libstardict.h"



int main()
{
  Dictionary dict(NULL);
#if 1  
  dict.load("/home/evgeniy/test/sk-dictionary/stardict-en-sk-2005.01.11/dictd_en-sk.ifo");
#else
  dict.load("/usr/share/stardict/dic/dictd_www.dict.org_wn.ifo");
#endif
#if 0
  glong index;
  dict.Lookup("accros", &index);
  printf("%s\n", dict.GetWord(index));
#else
  printf("wordcount=%ld\n", dict.length());
  std::string prev_str=dict.GetWord(0);
  printf("%s\n", dict.GetWord(0));
  for(glong i=1; i<dict.length(); ++i){
	printf("%s\n", dict.GetWord(i));
	if(stardict_strcmp(prev_str.c_str(), dict.GetWord(i))>0)
	  fprintf(stderr, "Error: prev_str=%s, cur_str=%s\n", prev_str.c_str(), dict.GetWord(i));
	prev_str=dict.GetWord(i);
  }
#endif  
  return EXIT_SUCCESS;
}