新人、求助!!与CAD字库有关
如何导入cad(*.SHX)字库文件,输出对应的格式
比如:shx字库文件是:正楷:
用户输入:大山
就出现 正楷格式的:大山
下面就是我的解读的头文件:
#pragma once
#include <string>
#include "stdafx.h"
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#define CAPACITY 20
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::IO;
using namespace System::Collections::Generic;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
void ReadShx(String ^ss){
//目前难题就是无法把String类型的指针转换为char类型的常量指针
//难题二无法读取shx文件信息:
FILE *pfile=fopen("C:/Users/player1/Desktop/实习/任务5/shx/Cadfs.shx","a+");
long len=ftell(pfile);
char ch[10000];
fread(ch,1,10000,pfile);
int offset,contentlength;
fclose(pfile);
int chs[10000];
for(int i=0;i<10000;i++){
chs[i]=(int)ch[i];
}
/*unsigned char ch;
struct _stat st;
int f_s = 0;
FILE * fp,*fp1;
char s[5];
int i=0;
_stat( "FONT_GB.$$$", &st);
fp=fopen( "C:/Users/player1/Desktop/实习/任务5/shx/Cadfs.shx", "rb");
fp1=fopen( "C:/Users/player1/Desktop/实习/任务5/shx/Cadfs.txt", "w");
f_s = st.st_size;
while (f_s--)
{
fread(&ch,1,1,fp);
if(ch <16){
sprintf(s, "0x0%1x ",ch);
}
else{
sprintf(s, "0x%02x",ch);
}
fwrite(s,4,1,fp1);
fputc( ', ',fp1);
fputc( ' ',fp1);
i=i+1;
fseek(fp1,i,0);
if(i%16==0)
fputc( '\n',fp1);
}
fclose(fp);
fclose(fp1); */
return ;
}
[解决办法]
我帮楼主找到个API,楼主有兴趣我们交换QQ私下交流下