void print_kanji (struct wnn_dai_bunsetsu *dlist, int cnt) { int i; struct wnn_sho_bunsetsu *sbn; if (dlist == 0) return; putchar ('\n'); for (; cnt > 0; dlist++, cnt--) { sbn = dlist->sbn; for (i = dlist->sbncnt; i > 0; i--) { putws (sbn->kanji); printf ("-"); putws (sbn->fuzoku); printf (" "); sbn++; } printf ("|"); } putchar ('\n'); fflush (stdout); }
/* ------------------------------------------------------------------------------- Function Name : CTestWideApi::getws_val API Tested : getws TestCase Description: The test case takes a wide character string from standard input. ------------------------------------------------------------------------------- */ TInt CTestWideApi::getws_val() { FILE* stdop = freopen("c:\\stdop","w+",stdout); FILE* stdip = freopen("c:\\stdip","w+",stdin); wchar_t* buf = (wchar_t*)malloc(sizeof(wchar_t)*50); if(buf==NULL) { fclose(stdin); fclose(stdop); remove("c:\\stdop"); remove("c:\\stdip"); return KErrNoMemory; } wchar_t s[100]; TInt ret = KErrNone; size_t size = fwrite("sushma\n", 1, 6, stdip); fclose(stdip); stdip = freopen("c:\\stdip","r", stdin); getws(s); // read a line (from stdin) putws(s); fclose(stdop); stdop = freopen("c:\\stdop","r", stdout); //size = fread(buf, 1, 6, stdop); fgetws(buf,7,stdop); if(wcsncmp(s, buf,6)) { ret = KErrGeneral; } fclose(stdin); fclose(stdop); remove("c:\\stdop"); remove("c:\\stdip"); free(buf); return ret; }
/* ------------------------------------------------------------------------------- Function Name : CTestWideApi::putws_nullL API Tested : putws TestCase Description: The testcase funtion tests the behaviour of putws for NULL argument. ------------------------------------------------------------------------------- */ TInt CTestWideApi::putws_null() { INFO_PRINTF1(_L("putws1")); int ret = putws(NULL); if(ret>0) { return KErrGeneral; } else { return KErrNone; } }
/* ------------------------------------------------------------------------------- Function Name : CTestWideApi::putws_val2L API Tested : putws TestCase Description: The testcase function will write a wide string to the screen which has a null terminator in the middle of the string. ------------------------------------------------------------------------------- */ TInt CTestWideApi::putws_val2() { INFO_PRINTF1(_L("putws2")); wchar_t buf[10]; FILE* stdop = freopen("c:\\stdop","w+",stdout); putws(L"Hel\0lo World"); fclose(stdop); stdop = freopen("c:\\stdop","r",stdout); fgetws(buf, 4, stdop); fclose(stdop); remove("c:\\stdop"); if(!wcsncmp(L"Hel", buf, 4)) { return KErrNone; } else { return KErrGeneral; } }
/* ------------------------------------------------------------------------------- Function Name : CTestWideApi::putws_val1 API Tested : putws TestCase Description: The testcase funtion will write a fixed lenth wide char string to the stdout. ------------------------------------------------------------------------------- */ TInt CTestWideApi::putws_val1() { INFO_PRINTF1(_L("putws")); wchar_t buf[12]; FILE* stdop = freopen("c:\\stdop","w+",stdout); FILE* op; putws(L"Hello World"); fclose(stdop); op = freopen("c:\\stdop","r",stdout); fgetws(buf, 12, op); fclose(stdop); remove("c:\\stdop"); if(!(wcsncmp(L"Hello World", buf, 11))) { return KErrNone; } else { return KErrGeneral; } }