How to write bangla text in c programming with codeblocks


 Coding:

সি প্রোগ্রামিং-এ বাংলা লিখুন । 

#include <wchar.h>
#include <locale.h>
#include <stdio.h>
 
int main() {
    setlocale(LC_ALL, "");
    FILE *file = fopen("output2.txt", "w, ccs=UTF-8");
    if (file == NULL) {
        return 1;
    }
    wchar_t *text = L"আমার সোনার বাংলা আমি তোমায় ভালোবাসি";
    fwprintf(file, L"%ls\n", text);
    fclose(file);
    return 0;
}


Just write the code and save using the name with the .c extension. 

Remember, your system must require any Bangla-supported software Ovro/Bijoy etc. And then your IDE in UTF-8 encoding mode. 

The above program will produce the output in output2.txt file. Because, in the setting of the console of code blocks if you do not set Bangla-supported font, then the console will not show the result. And in that case, you can face a lot of problems, that is why I am showing you the results in file. So that you can't face any problem. 




No comments:

Post a Comment