banner

[Rule] Rules  [Home] Main Forum  [Portal] Portal  
[Members] Member Listing  [Statistics] Statistics  [Search] Search  [Reading Room] Reading Room 
[Register] Register  
[Login] Loginhttp  | https  ]
 
Forum Index Thảo luận hệ điều hành Windows Lập trình tiếng Việt trong C/C++  XML
  [Programming]   Lập trình tiếng Việt trong C/C++ 08/08/2007 22:42:59 (+0700) | #1 | 77807
[Avatar]
quan_vu
Member

[Minus]    0    [Plus]
Joined: 31/01/2007 13:35:02
Messages: 19
Offline
[Profile] [PM]
Chào tất cả các bạn!
Có bạn nào biết cách đưa tiếng Việt vào trong C hay C++ không.
Mong các bạn chỉ giáo
[Up] [Print Copy]
  [Question]   Lập trình tiếng Việt trong C/C++ 08/08/2007 23:27:19 (+0700) | #2 | 77823
[Avatar]
Z0rr0
Q+WRtaW5pc3RyYXRvc+g

Joined: 14/08/2002 12:52:01
Messages: 1323
Location: Underground
Offline
[Profile] [PM] [WWW] [Yahoo!]
Xem bạn mô tả thì ngầm hiểu là C/C++ cho ứng dụng console (ko phải visual), thể hiện các kí tự sử dụng bảng mã ASCII.
Như vậy bạn cần tìm hiểu cách từng kí tự thể hiện trên màn hình console và can thiệp vào vùng nhớ chứa các kí tự này và thay đổi các kí tự (ít sử dụng) bằng các kí tự tiếng Việt.
Gợi ý thêm: mỗi kí tự khi thể hiện là 1 ma trận điểm
Hibernating
[Up] [Print Copy]
  [Question]   Lập trình tiếng Việt trong C/C++ 09/08/2007 10:48:48 (+0700) | #3 | 77970
MicrosoftX
Member

[Minus]    0    [Plus]
Joined: 04/03/2007 20:46:12
Messages: 91
Offline
[Profile] [PM]

quan_vu wrote:
Chào tất cả các bạn!
Có bạn nào biết cách đưa tiếng Việt vào trong C hay C++ không.
Mong các bạn chỉ giáo 


Nếu ứng dụng bạn lập là GUI, thực thi trên các hệ điều hành hỗ trợ GUI (windows ...) thì bạn hãy tham khảo các đối tượng font và sự hỗ trợ unicode của môi trường lập trình.

Nếu ứng dụng của bạn là console, 16bit, được thực thi trên môi trường MS DOS hoặc môi trường giả lập MS DOS của Windows (windows có một cơ chế thực thi riêng đảm bảo sự tương thích cho những ứng dụng 16 bit cũ smilie) thì khi đó bạn cần thay đổi hệ thống font hiển thị được MS DOS load từ ROM BIOS vào bộ nhớ khi khởi động. Cách thay đổi ở đây đó chính là thay đổi các kí tự thuộc ASCII mở rộng của bảng ASCII. Đó là sơ lược về mặt ý tưởng. Mình ko có thời gian nên ko trình bày chi tiết, hơn nữa những kiến thức dưới đây, cũng cũ rồi smilie để ở phòng thí nghiệm cho vui thôi.

Ứng dụng console 16bit for DOS thường đc biên dịch = TC3.0 hoặc BC3.0, BC5.0 ... và đây là đoạn code mình viết sẵn từ hồi còn học smilie; Đoạn code này đảm bảo cho bạn hiển thị đc tiếng việt khi lập trình với C++, C.

FileName: FONTVN.H

Code:
/*	fontvn.h

	Copyright (C) 2005 by Nguyen Hoang.
	
*/

#if !defined(__FONTVN_H)
#define __FONTVN_H

#if !defined(__STDIO_H)
#include <stdio.h>
#endif

#if !defined(__CONIO_H)
#include <conio.h>
#endif

#if !defined(__DOS_H)
#include <dos.h>
#endif

int changeFont(void);

/* Change font */	
int changeFont(void){
		int	i, j;
		char	vnfont[16*256]={		
	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
	24,24,24,24,24,24,24,248,0,0,0,0,0,0,0,0,
	240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
	255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,
	0,254,2,3,63,3,3,3,3,3,3,3,255,255,0,0,
	0,254,254,254,254,126,62,30,14,6,254,254,254,254,254,0,
	255,1,1,1,1,1,1,249,249,1,1,1,1,1,1,255,
	0,0,0,0,0,0,24,60,60,24,0,0,0,0,0,0,
	0,255,0,0,0,0,0,0,0,0,0,0,255,255,0,0,
	0,254,254,126,62,30,14,6,126,126,126,126,126,254,254,0,
	0,254,254,126,126,126,126,126,6,14,30,62,126,254,254,0,
	0,0,248,4,254,2,3,3,3,3,3,3,255,255,0,0,
	255,128,129,131,135,143,159,191,131,131,131,131,131,128,128,255,
	0,254,2,3,3,255,3,3,3,3,3,3,255,255,0,0,
	0,254,2,115,131,131,131,115,3,3,3,3,255,255,0,0,
	0,254,2,3,195,67,251,67,195,3,3,3,255,255,0,0,
	0,0,64,96,112,120,124,126,124,120,112,96,64,0,0,0,
	0,0,1,3,7,15,31,63,31,15,7,3,1,0,0,0,
	0,254,2,243,139,243,147,139,3,3,3,3,255,255,0,0,
	0,254,2,251,131,243,131,251,3,3,3,3,255,255,0,0,
	255,1,125,125,171,215,239,239,239,215,187,109,85,41,1,255,
	0,254,130,130,130,84,40,16,16,40,68,130,170,214,254,0,
	0,0,0,0,0,0,0,255,24,24,24,24,24,24,24,24,
	0,1,3,2,6,4,12,136,216,80,112,32,0,0,0,0,
	0,0,0,0,8,28,62,127,28,28,28,28,0,0,0,0,
	0,0,0,0,28,28,28,28,127,62,28,8,0,0,0,0,
	0,0,0,0,0,0,24,12,254,12,24,0,0,0,0,0,
	0,0,0,0,0,0,48,96,254,96,48,0,0,0,0,0,
	0,127,126,124,127,111,79,0,0,79,111,127,124,126,127,0,
	0,126,62,30,126,118,114,0,0,114,118,126,30,62,126,0,
	0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,
	255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
	0,0,0,0,24,60,60,60,24,24,0,24,24,0,0,0,
	0,0,0,102,102,102,36,0,0,0,0,0,0,0,0,0,
	0,0,0,0,108,108,254,108,108,108,254,108,108,0,0,0,
	0,0,24,24,124,198,194,192,124,6,134,198,124,24,24,0,
	0,0,0,0,0,0,194,198,12,24,48,102,198,0,0,0,
	0,0,0,0,56,108,108,56,118,220,204,204,118,0,0,0,
	0,0,0,48,48,48,96,0,0,0,0,0,0,0,0,0,
	0,0,0,0,12,24,48,48,48,48,48,24,12,0,0,0,
	0,0,0,0,48,24,12,12,12,12,12,24,48,0,0,0,
	0,0,0,0,0,0,102,60,255,60,102,0,0,0,0,0,
	0,0,0,0,0,0,24,24,126,24,24,0,0,0,0,0,
	0,0,0,0,0,0,0,0,0,0,24,24,24,48,0,0,
	0,0,0,0,0,0,0,0,254,0,0,0,0,0,0,0,
	0,0,0,0,0,0,0,0,0,0,0,24,24,0,0,0,
	0,0,0,0,2,6,12,24,48,96,192,128,0,0,0,0,
	0,0,0,0,124,198,206,222,246,230,198,198,124,0,0,0,
	0,0,0,0,24,56,120,24,24,24,24,24,126,0,0,0,
	0,0,0,0,124,198,6,12,24,48,96,198,254,0,0,0,
	0,0,0,0,124,198,6,6,60,6,6,198,124,0,0,0,
	0,0,0,0,12,28,60,108,204,254,12,12,30,0,0,0,
	0,0,0,0,254,192,192,192,252,6,6,198,124,0,0,0,
	0,0,0,0,60,96,192,192,252,198,198,198,124,0,0,0,
	0,0,0,0,254,198,6,12,24,48,48,48,48,0,0,0,
	0,0,0,0,124,198,198,198,124,198,198,198,124,0,0,0,
	0,0,0,0,124,198,198,198,126,6,6,12,120,0,0,0,
	0,0,0,0,0,24,24,0,0,0,24,24,0,0,0,0,
	0,0,0,0,0,24,24,0,0,0,24,24,48,0,0,0,
	0,0,0,0,6,12,24,48,96,48,24,12,6,0,0,0,
	0,0,0,0,0,0,0,126,0,0,126,0,0,0,0,0,
	0,0,0,0,96,48,24,12,6,12,24,48,96,0,0,0,
	0,0,0,0,124,198,198,12,24,24,0,24,24,0,0,0,
	0,0,0,0,124,198,198,222,222,222,220,192,124,0,0,0,
	0,0,0,0,16,56,108,198,198,254,198,198,198,0,0,0,
	0,0,0,0,252,102,102,102,124,102,102,102,252,0,0,0,
	0,0,0,0,60,102,194,192,192,192,194,102,60,0,0,0,
	0,0,0,0,248,108,102,102,102,102,102,108,248,0,0,0,
	0,0,0,0,254,102,98,104,120,104,98,102,254,0,0,0,
	0,0,0,0,254,102,98,104,120,104,96,96,240,0,0,0,
	0,0,0,0,60,102,194,192,192,222,198,102,58,0,0,0,
	0,0,0,0,198,198,198,198,254,198,198,198,198,0,0,0,
	0,0,0,0,60,24,24,24,24,24,24,24,60,0,0,0,
	0,0,0,0,30,12,12,12,12,12,204,204,120,0,0,0,
	0,0,0,0,230,102,108,108,120,108,108,102,230,0,0,0,
	0,0,0,0,240,96,96,96,96,96,98,102,254,0,0,0,
	0,0,0,0,198,238,254,254,214,198,198,198,198,0,0,0,
	0,0,0,0,198,230,246,254,222,206,198,198,198,0,0,0,
	0,0,0,0,56,108,198,198,198,198,198,108,56,0,0,0,
	0,0,0,0,252,102,102,102,124,96,96,96,240,0,0,0,
	0,0,0,0,124,198,198,198,198,214,222,124,12,14,0,0,
	0,0,0,0,252,102,102,102,124,108,102,102,231,0,0,0,
	0,0,0,0,124,198,198,96,56,12,198,198,124,0,0,0,
	0,0,0,0,126,126,90,24,24,24,24,24,60,0,0,0,
	0,0,0,0,198,198,198,198,198,198,198,198,124,0,0,0,
	0,0,0,0,198,198,198,198,198,198,108,56,16,0,0,0,
	0,0,0,0,198,198,198,198,214,214,254,124,108,0,0,0,
	0,0,0,0,198,198,108,56,56,56,108,198,198,0,0,0,
	0,0,0,0,102,102,102,102,60,24,24,24,60,0,0,0,
	0,0,0,0,254,198,140,24,48,96,194,198,254,0,0,0,
	0,0,0,0,60,48,48,48,48,48,48,48,60,0,0,0,
	0,0,0,0,128,192,224,112,56,28,14,6,2,0,0,0,
	0,0,0,0,60,12,12,12,12,12,12,12,60,0,0,0,
	0,0,16,56,108,198,0,0,0,0,0,0,0,0,0,0,
	0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,
	0,0,48,48,24,0,0,0,0,0,0,0,0,0,0,0,
	0,0,0,0,0,0,0,120,12,124,204,204,118,0,0,0,
	0,0,0,0,224,96,96,120,108,102,102,102,124,0,0,0,
	0,0,0,0,0,0,0,124,198,192,192,198,124,0,0,0,
	0,0,0,0,28,12,12,60,108,204,204,204,118,0,0,0,
	0,0,0,0,0,0,0,124,198,254,192,198,124,0,0,0,
	0,0,0,0,56,108,100,96,240,96,96,96,240,0,0,0,
	0,0,0,0,0,0,0,118,204,204,204,124,12,204,120,0,
	0,0,0,0,224,96,96,108,118,102,102,102,230,0,0,0,
	0,0,0,0,24,24,0,56,24,24,24,24,60,0,0,0,
	0,0,0,0,6,6,0,14,6,6,6,6,102,102,60,0,
	0,0,0,0,224,96,96,102,108,120,108,102,230,0,0,0,
	0,0,0,0,56,24,24,24,24,24,24,24,60,0,0,0,
	0,0,0,0,0,0,0,236,254,214,214,214,198,0,0,0,
	0,0,0,0,0,0,0,220,102,102,102,102,102,0,0,0,
	0,0,0,0,0,0,0,124,198,198,198,198,124,0,0,0,
	0,0,0,0,0,0,0,220,102,102,102,124,96,96,240,0,
	0,0,0,0,0,0,0,118,204,204,204,124,12,12,30,0,
	0,0,0,0,0,0,0,220,118,102,96,96,240,0,0,0,
	0,0,0,0,0,0,0,124,198,112,28,198,124,0,0,0,
	0,0,0,0,16,48,48,252,48,48,48,54,28,0,0,0,
	0,0,0,0,0,0,0,204,204,204,204,204,118,0,0,0,
	0,0,0,0,0,0,0,102,102,102,102,60,24,0,0,0,
	0,0,0,0,0,0,0,198,198,214,214,254,108,0,0,0,
	0,0,0,0,0,0,0,198,108,56,56,108,198,0,0,0,
	0,0,0,0,0,0,0,198,198,198,198,126,6,12,248,0,
	0,0,0,0,0,0,0,254,204,24,48,102,254,0,0,0,
	0,0,0,0,14,24,24,24,112,24,24,24,14,0,0,0,
	0,0,0,0,24,24,24,24,0,24,24,24,24,0,0,0,
	0,0,0,0,112,24,24,24,14,24,24,24,112,0,0,0,
	0,0,0,0,118,220,0,0,0,0,0,0,0,0,0,0,
	0,0,0,0,0,0,16,56,108,198,198,254,0,0,0,0,
	0,0,0,0,0,0,124,198,192,192,198,124,24,12,248,0,
	0,0,0,0,204,204,0,204,204,204,204,204,118,0,0,0,
	0,0,0,0,108,108,0,120,12,124,204,204,118,0,0,0,
	0,0,48,72,72,48,0,120,12,124,204,204,118,0,0,0,
	0,0,0,0,108,108,0,124,198,254,192,198,124,0,0,0,
	0,0,0,0,108,108,0,56,24,24,24,24,60,0,0,0,
	0,0,0,24,60,102,0,56,24,24,24,24,60,0,0,0,
	0,0,0,0,108,222,26,26,126,216,216,218,108,0,0,0,
	0,0,0,0,204,204,0,124,198,198,198,198,124,0,0,0,
	0,0,0,48,120,204,0,204,204,204,204,204,118,0,0,0,
	0,0,0,0,198,198,0,198,198,198,198,126,6,12,120,0,
	0,0,24,24,24,124,198,192,192,198,124,24,24,24,0,0,
	0,0,0,56,108,100,96,240,96,96,102,230,188,0,0,0,
	0,0,0,102,102,102,60,24,126,24,60,24,24,0,0,0,
	0,0,0,252,102,102,124,98,102,111,102,102,243,0,0,0,
	0,0,0,0,118,220,0,220,102,102,102,102,102,0,0,0,
	0,0,0,0,0,0,54,108,216,108,54,0,0,0,0,0,
	0,0,0,0,0,0,216,108,54,108,216,0,0,0,0,0,
	0,0,0,0,24,24,24,126,24,24,24,0,126,126,0,0,
	0,0,0,0,96,48,24,12,24,48,96,0,124,124,0,0,
	0,0,0,0,12,24,48,96,48,24,12,0,124,124,0,0,
	24,24,24,60,60,126,126,255,24,24,24,24,24,24,24,24,
	24,24,24,24,24,24,24,24,255,126,126,60,60,24,24,24,
	0,0,0,0,0,64,112,124,255,124,112,64,0,0,0,0,
	0,0,0,0,0,2,14,62,255,62,14,2,0,0,0,0,
	0,224,32,48,48,48,48,48,48,48,48,48,240,240,0,0,
	255,128,128,128,128,128,128,159,159,128,128,128,128,128,128,255,
	192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
	255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
	0,240,24,28,30,30,3,3,3,3,3,3,255,255,0,0,
	0,254,1,0,124,254,254,254,254,124,0,1,254,0,0,0,
	0,0,0,128,128,64,64,64,64,128,128,0,0,0,0,0,
	0,0,0,0,0,0,0,255,192,192,192,192,192,192,192,192,
	0,0,108,56,0,56,108,198,198,254,198,198,198,0,0,0,
	0,16,56,108,0,56,108,198,198,254,198,198,198,0,0,0,
	0,16,56,68,254,102,98,104,120,104,98,102,254,0,0,0,
	0,16,56,68,56,108,198,198,198,198,198,108,56,0,0,0,
	0,0,3,1,58,108,198,198,198,198,198,108,56,0,0,0,
	0,0,3,1,199,198,198,198,198,198,198,198,124,0,0,0,
	0,0,0,0,248,108,102,102,254,102,102,108,248,0,0,0,
	0,0,0,0,108,56,0,120,12,124,204,204,118,0,0,0,
	0,0,0,0,56,108,0,120,12,124,204,204,118,0,0,0,
	0,0,0,0,56,108,0,124,198,254,192,198,124,0,0,0,
	0,0,0,0,56,108,0,124,198,198,198,198,124,0,0,0,
	0,0,0,0,0,3,1,126,198,198,198,198,124,0,0,0,
	0,0,0,0,0,3,1,206,204,204,204,204,118,0,0,0,
	0,0,0,0,12,62,12,60,108,204,204,204,118,0,0,0,
	0,224,96,112,112,112,112,112,112,112,112,112,240,240,0,0,
	0,255,0,0,0,0,0,0,0,0,0,0,255,255,0,0,
	0,255,192,192,195,194,223,194,195,192,192,192,255,63,0,0,
	0,255,192,192,192,192,192,192,192,192,192,192,255,63,0,0,
	24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
	255,255,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
	0,0,192,96,48,0,0,120,12,124,204,204,118,0,0,0,
	0,0,56,8,16,0,0,120,12,124,204,204,118,0,0,0,
	0,0,0,118,220,0,0,120,12,124,204,204,118,0,0,0,
	0,0,6,12,24,0,0,120,12,124,204,204,118,0,0,0,
	0,0,0,0,0,0,0,120,12,124,204,204,118,0,48,48,
	54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,
	0,0,96,16,76,56,0,120,12,124,204,204,118,0,0,0,
	0,0,7,1,110,56,0,120,12,124,204,204,118,0,0,0,
	0,0,118,220,108,56,0,120,12,124,204,204,118,0,0,0,
	0,0,12,16,108,56,0,120,12,124,204,204,118,0,0,0,
	0,0,0,0,0,0,0,248,24,24,24,24,24,24,24,24,
	255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
	1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,255,
	255,255,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
	0,7,6,6,6,6,6,6,6,6,6,6,7,1,0,0,
	0,255,0,6,6,12,12,152,216,240,112,0,255,255,0,0,
	192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,255,
	0,0,0,0,108,56,0,120,12,124,204,204,118,0,48,48,
	0,0,192,96,56,108,0,120,12,124,204,204,118,0,0,0,
	0,0,7,1,58,108,0,120,12,124,204,204,118,0,0,0,
	0,0,118,220,56,108,0,120,12,124,204,204,118,0,0,0,
	0,0,6,12,56,108,0,120,12,124,204,204,118,0,0,0,
	0,0,0,0,56,108,0,120,12,124,204,204,118,0,48,48,
	0,0,192,96,48,0,0,124,198,254,192,198,124,0,0,0,
	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,
	0,0,56,8,16,0,0,124,198,254,192,198,124,0,0,0,
	0,0,0,118,220,0,0,124,198,254,192,198,124,0,0,0,
	0,0,6,12,24,0,0,124,198,254,192,198,124,0,0,0,
	0,0,0,0,0,0,0,124,198,254,192,198,124,0,24,24,
	0,48,24,12,56,108,0,124,198,254,192,198,124,0,0,0,
	0,0,7,1,58,108,0,124,198,254,192,198,124,0,0,0,
	0,0,118,220,56,108,0,124,198,254,192,198,124,0,0,0,
	0,0,6,12,56,108,0,124,198,254,192,198,124,0,0,0,
	0,0,0,0,56,108,0,124,198,254,192,198,124,0,24,24,
	0,0,192,96,48,0,0,56,24,24,24,24,60,0,0,0,
	0,0,56,8,16,0,0,56,24,24,24,24,60,0,0,0,
	1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
	255,255,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
	255,128,128,128,128,128,128,159,159,128,128,128,128,128,128,255,
	0,0,0,118,220,0,0,56,24,24,24,24,60,0,0,0,
	0,0,6,12,24,0,0,56,24,24,24,24,60,0,0,0,
	0,0,0,0,24,24,0,56,24,24,24,24,60,0,24,24,
	0,0,192,96,48,0,0,124,198,198,198,198,124,0,0,0,
	0,0,0,0,62,96,192,192,254,192,192,96,62,0,0,0,
	0,0,56,8,16,0,0,124,198,198,198,198,124,0,0,0,
	0,0,118,220,0,0,0,124,198,198,198,198,124,0,0,0,
	0,0,6,12,24,0,0,124,198,198,198,198,124,0,0,0,
	0,0,0,0,0,0,0,124,198,198,198,198,124,0,24,24,
	0,0,192,96,56,108,0,124,198,198,198,198,124,0,0,0,
	0,0,7,1,58,108,0,124,198,198,198,198,124,0,0,0,
	0,0,118,220,56,108,0,124,198,198,198,198,124,0,0,0,
	0,0,6,12,56,108,0,124,198,198,198,198,124,0,0,0,
	0,0,0,0,56,108,0,124,198,198,198,198,124,0,24,24,
	0,0,192,96,48,3,1,126,198,198,198,198,124,0,0,0,
	0,0,56,8,16,3,1,126,198,198,198,198,124,0,0,0,
	0,0,118,220,0,3,1,126,198,198,198,198,124,0,0,0,
	0,0,6,12,24,3,1,126,198,198,198,198,124,0,0,0,
	0,0,0,0,0,3,1,126,198,198,198,198,124,0,24,24,
	0,0,192,96,48,0,0,204,204,204,204,204,118,0,0,0,
	0,0,0,0,0,254,0,0,254,0,0,254,0,0,0,0,
	0,0,56,8,16,0,0,204,204,204,204,204,118,0,0,0,
	0,0,118,220,0,0,0,204,204,204,204,204,118,0,0,0,
	0,0,6,12,24,0,0,204,204,204,204,204,118,0,0,0,
	0,0,0,0,0,0,0,204,204,204,204,204,118,0,48,48,
	0,0,192,96,48,3,1,206,204,204,204,204,118,0,0,0,
	0,0,56,8,16,3,1,206,204,204,204,204,118,0,0,0,
	0,0,118,220,0,3,1,206,204,204,204,204,118,0,0,0,
	0,0,6,12,24,3,1,206,204,204,204,204,118,0,0,0,
	0,0,0,0,0,3,1,206,204,204,204,204,118,0,48,48,
	0,0,192,96,48,0,0,198,198,198,198,126,6,12,248,0,
	0,0,56,8,16,0,0,198,198,198,198,126,6,12,248,0,
	0,0,0,118,220,0,0,198,198,198,198,126,6,12,248,0,
	0,0,6,12,24,0,0,198,198,198,198,126,6,12,248,0,
	0,0,0,0,0,0,0,198,198,198,198,126,4,12,251,3,
	0,254,1,0,0,0,0,0,0,0,0,1,254,0,0,0
};
		textmode(C80);
		asm{
				cli				
				mov dx,0x3c4	
				mov ax,0x100	
				out dx,ax
				mov ax,0x402	
				out dx,ax
				mov ax,0x704	
				out dx,ax
				mov ax,0x300	
				out dx,ax
	
				mov dx,0x3ce	
				mov ax,0x204	
				out dx,ax
				mov ax,0x5		
				out dx,ax
				mov ax,0x406	
				out dx,ax
			}
			for(i=0;i<256;++i)
				for(j=0;j<16;++j)
					pokeb(0xa000, i*32+j, vnfont[i*16+j]);	
		asm{
				mov dx,0x3c4
				mov ax,0x100	
				out dx,ax
				mov ax,0x302	
				out dx,ax
				mov ax,0x304	
				out dx,ax
				mov ax,0x300	
				out dx,ax
	
				mov dx,0x3ce
				mov ax,0x4		
				out dx,ax
				mov ax,0x1005	
				out dx,ax
				mov ax,0xe06	
				out dx,ax
				cli
			}
		return 1;		
	}

#endif  /* __FONTVN_H */


Thông tin:

Mình có tham khảo mã nguồn của BKAV phiên bản cũ (chả rõ là bao nhiêu) để viết thư viện này.

Kí tự trong bộ thư viện này tương thích với TCVN3(ABC). Điều này có nghĩa, khi soạn thảo mã nguồn, bạn hãy config trình editor sử dụng font .vntime hoặc .vnarial ...; tiếp đó hãy định cấu hình bộ gõ (Unikey) là TCVN3(ABC), rồi sử dụng để viết tiếng việt ra trong những hàm kết xuất dữ liệu ra màn hình của C.

(nên dùng Notepad++ hoặc Notepad vì các editor trong IDE của TC3.0 không hỗ trợ việc soạn thảo mã tiếng Việt).

Hướng dẫn sử dụng thư viện này:

1 - Khi biên dịch, yêu cầu trình biên dịch cần hỗ trợ Assembly (mặc định hỗ trợ đó).

2 - Trình biên dịch tương thích cho module này là trình biên dịch ứng dụng 16bit ví dụ TC3.0

3 - Module trong file này được viết bằng hợp ngữ 16bit, bạn không thể dùng các trình biên dịch C 32 bit được.

4 - Copy tệp này vào thư mục INCLUDES của thư mục chứa bộ Dịch C/C++.

5 - Hãy sử dụng hệ thống soạn thảo mã lệnh khác. Ví dụ Notepad++, Notepad; sử dụng font .VnTime , Unikey để soạn thảo tiếng Việt.

6 - Khi viết chương trình hãy thực hiện: include <FONTVN.H>;

7 - Trong hàm main(), trước mọi các thao tác hiển thị, hãy gọi hàm changeFont();

8 - Bây giờ bạn có thể viết tiếng Việt ra màn hình trong những hàm kết xuất dữ liệu ra màn hình (ví dụ printf("Alo Alo Hì Hì")smilie;

Việc sử dụng thư viện rất đơn giản, chỉ là include vào rồi thì gọi hàm changeFont() vậy thôi.

Bạn chú ý kĩ cho tôi bước 5, 6, 7 đó là bước soạn thảo !!!
[Up] [Print Copy]
  [Question]   Lập trình tiếng Việt trong C/C++ 09/08/2007 10:54:42 (+0700) | #4 | 77974
MicrosoftX
Member

[Minus]    0    [Plus]
Joined: 04/03/2007 20:46:12
Messages: 91
Offline
[Profile] [PM]
ah chú ý thêm, khi gọi hàm này, các kí tự bảng mã ASCII mở rộng đã bị thay đổi. Để thiết lập lại bảng mã ASCII mở rộng mặc định, hãy sử dụng hàm:

textmode(C80); để reset smilie
[Up] [Print Copy]
[digg] [delicious] [google] [yahoo] [technorati] [reddit] [stumbleupon]
Go to: 
 Users currently in here 
1 Anonymous

Powered by JForum - Extended by HVAOnline
 hvaonline.net  |  hvaforum.net  |  hvazone.net  |  hvanews.net  |  vnhacker.org
1999 - 2013 © v2012|0504|218|