zoukankan      html  css  js  c++  java
  • convert.cpp

    代码
    // convert.cpp : 定义控制台应用程序的入口点。
    //

    #include 
    "stdafx.h"
    #include 
    <stdlib.h>
    #include 
    <string.h>

    int _tmain(int argc, _TCHAR* argv[])
    {
     FILE   
    *fp1;   //文件指针
     FILE   *fp2;   
     
    char buf[1024];//缓冲区 
     if(NULL == (fp1 = fopen("utf8.tab","r")))
     {
      exit(
    -1);
     }
     
    else
     {
      
    char *p1;
      unsigned 
    short d1;
      unsigned 
    long d2;
      
    char ch;

      
    if(NULL == (fp2 = fopen("txt.txt","w+")))
      {
       printf(
    "打开文件失败\n");
       exit(
    -1);
      }

      
    while(1)
      {
       
    if(NULL == fgets(buf,sizeof(buf)-1,fp1)) 
        
    break;
       p1
    =buf;
       memcpy(
    &d1,buf,2);
       
    if(6 == strlen(p1))
       {
        memcpy(
    &d2,buf+2,3);
       }
       
    if(5 == strlen(p1))
       { 
        memcpy(
    &d2,buf+2,2); 
       }
       fwrite(
    &d1,2,1,fp2);
       fwrite(
    &d2,3,1,fp2);
      }
      fclose(fp2);
     }
     
    return 0;
    }

     
  • 相关阅读:
    取时间
    DEV控件属性
    Dev之barManager控件属性
    linq查询Contains
    绑定
    运算符转换方法组和int类型的操作数
    学习计划实践
    学习计划2
    foreacht学习
    Spring5源码分析(二) IOC 容器的初始化(五)
  • 原文地址:https://www.cnblogs.com/kakaliush/p/1624763.html
Copyright © 2011-2022 走看看