rishi
rishi

Reputation: 759

c or c++ on visual studio

i ma using visual c++ for my dictionary project ..... but visual c++ hangs on compilation ....while this same code runs well on Linux mint.... i am using visual studio for that i want to give my code GUI form.... here's my code

///////////////////////////////////////////
#include<stdio.h> 
int upper[30],lower[30],indno=0,row=0,col=-1;

char *p[]={"a",
"एक, अंग्रेजी वर्णमाला का प्रथम अक्षर तथा स्वर,( तर्क मे) पहला कल्पित पुरुष वा प्रस्ताव",
"aback",
"अचानक, एकाएक,पीछे",
"abandon",
"छोड देना, त्याग देना, त्यागना, तजना,बिना आज्ञा नौकरी छोडना, अपने को( दुराचार आदि में) छोड देना, दे देना",
"abandoned",
"छोडा हुआ, निर्जन( स्थान) ,बिगडा हुआ, इन्द्रिय लोलुप, लम्पट, दुराचारी, आवारा",
"abandonment",
"पूर्ण त्याग, सम्पूर्ण आत्मोत्सर्ग, बिल्कुल छोड देना",
//.
//.
//.
//. ///////////////remaining 15000 words and meaning
//.
//.
//. 
};

void main()
{

 }

Upvotes: 0

Views: 148

Answers (1)

Mohit Jain
Mohit Jain

Reputation: 30489

Collecting from my comments (as confirmed by the OP): You are using hindi strings in your program which may not be supported by your current encoding. You can convert all char strings to wide char strings (unicode) by prepending an L to strings and change the type of strings from char * to wchar_t *.

If this change works for you, you would need more changes like:

strlen -> wcslen
%s -> %ls (in print)
printf -> wprintf (Optional)

#include <stdio.h>
#include <wchar.h>
#include <locale.h>

wchar_t *p[]={L"a",
              L"एक, अंग्रेजी वर्णमाला का प्रथम अक्षर तथा स्वर,( तर्क मे) पहला कल्पित पुरुष वा प्रस्ताव",
              L"aback",
              L"अचानक, एकाएक,पीछे",
};

int main()
{
  setlocale(LC_CTYPE, "en_IN");
  wprintf(L"%ls -> %ls\n", p[0], p[1]);
  wprintf(L"%ls -> %ls\n", p[2], p[3]);
  return 0;
}

Upvotes: 1

Related Questions