utf8.cpp

来自「《UIQ 3 The Complete Guide》书的源代码」· C++ 代码 · 共 43 行

CPP
43
字号
//
// This is the entire source code for the little utility application used to convert Notepad based UTF8 text 
// files to Symbian Resource compilier UTF8 compatible UTF8 files. 
//
// Basically all we have to do is junk the first 3 chars of the file - the document BOM
//
// NOTE - THERE IS NO ERROR CHECKING, progress reporting, name validation etc in this app. Its the minimalist
// it can be!.
//
// Call in DOS batch file:
//
// utf8_conv Utf8_SignedApp.rls SignedApp.rls
//

#include "stdafx.h"
#include "stdio.h"


int main(int argc, char* argv[])
{
	puts("Utf8 conv");
	puts(argv[1]);
	puts(" to ");
	puts(argv[2]);

	FILE* src=fopen(argv[1],"r");
	fseek(src,3,0);	// junk 1st 3 chars - utf8 hdr
	FILE* dest=fopen(argv[2],"w");

	unsigned char bb[1024];
	while(1)
		{
		size_t ret=fread(&bb[0],1,1024,src);
		if (ret>0)
			fwrite(&bb[0],1,ret,dest);
		if (ret<1024)
			break;
		}
	fclose(src);
	fclose(dest);
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?