다음에 나열된 코드는 xPlatform의 msvcrt 모듈을 활용하여 ANSI, 유니코드 인코딩 아래에서 문자열의 길이를 측정하는 샘플 코드입니다.
using System;
using xPlatform;
using xPlatform.x86.msvcrt;
namespace xPlatformSample
{
class Program
{
static void Main(string[] args)
{
while (true)
{
Console.WriteLine("측정할 문자열을 입력하고 Enter를, 종료하려면 입력없이 Enter를 누르세요.");
Console.Write(">> ");
string input = Console.ReadLine();
if (input.Length < 1)
break;
Console.WriteLine();
Console.WriteLine("ANSI Length (strlen): {0} Byte(s)", msvcrt.strlen(input));
Console.WriteLine("Unicode Length (wcslen): {0} Char(s)", msvcrt.wcslen(input));
Console.WriteLine();
}
}
}
}
실행 결과
xPlatform 다운로드: http://blendxplatform.codeplex.com/
xPlatform 활용 예제는 계속 업로드될 예정입니다. xPlatform을 활용하는 예제들 중 필요한 것이 있으면 요청에 따라 예제 코드를 만들어서 공개할 수 있으니 많은 참여 부탁드립니다. :-)
'Project Blend: > Cross Platform' 카테고리의 다른 글
| xPlatform for Windows Azure 프로젝트를 시작합니다. (0) | 2010/02/28 |
|---|---|
| [예제] xPlatform X Visual C++ Example: 문자열 길이 측정 (0) | 2009/11/05 |
| Project Blend: xPlatform 2009년 11월판 런칭 (0) | 2009/11/01 |
| Project Blend: xPlatform 작업 기록 (2009년 6월 29일) (0) | 2009/06/29 |
| Project Blend: xPlatform 작업 기록 (2009년 4월 2일) (0) | 2009/04/02 |
| CLIFX xPlatform Repository Open (0) | 2008/01/27 |