zoukankan      html  css  js  c++  java
  • 去除MFC特性之一

    先对文件读取路径进行去除,然后对程序中出现的其他地方进行慢慢去除。

    #include "WavIo.h"
    #include "mfcc.h"
    #include "GMM.h"
    
    void main()
    {
        //string featpath = "G:\data";
        string wawfile = "MF.wav";                //转换正确——1
        const char* rawfile=wawfile.data();
    
        RealVec signal;
        wavfile::Read(rawfile, signal);
    
        RealMat features;
        MFCC::Run(signal, 12, features);
    
        GMM model;
        model.Train(features, 32);
        model.WriteTxt("ubm.txt");
    }
    //

    参考于:

    string 是c++标准库里面其中一个,封装了对字符串的操作 
    把string转换为char* 有3中方法: 
    1.data 
    如: 
    string str="abc"; 
    char*p=str.data(); 
    2.c_str 
    如:string str="gdfd"; 
         const char*p=str.c_str(); 
    3.copy
    比如 
    string str="hello"; 
    char p[40]; 
    str.copy(p,5,0); //这里5,代表复制几个字符,0代表复制的位置
    *(p+5)=''; //要手动加上结束符
    cout <<p;
  • 相关阅读:
    java 单链表 练习
    大问题-简明哲学导论
    git的常见错误
    python在Ubuntu添加模块搜索路径
    前端
    TCP/IP图解
    调试
    Design program
    算法
    面向对象-聚集,程序比较发现
  • 原文地址:https://www.cnblogs.com/taozijy/p/3723063.html
Copyright © 2011-2022 走看看