注册 登录
编程论坛 C++教室

关于stract使用的问题

书生牛犊 发布于 2016-08-12 16:35, 2867 次点击

程序代码:
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main()
{
    ifstream infile;
    ofstream outfile;
    char name[20];
    char c;
    cout<<"please entra filename"<<endl;
    cin>>name;
    infile.open(name);
    if(!infile)
    {
        cout<<"failure"<<endl;
        exit(1);
    }
    cout<<"start copy"<<endl;
    stract(name,"copyfile");
    outfile.open(name);
    if(!outfile)
    {
        cout<<"can not copy"<<endl;
        exit(1);
    }
    while(!outfile.eof())
    {
        infile.get(c);
        cout<<c;
        }
    cout<<endl;
    infile.close();
    outfile.close();      

    return 0;
}
23    27    E:\CPP\数据结构\test.cpp    [Error] 'stract' was not declared in this scope

stract没定义应该是头文件的原因吧,但是我在头文件定义了cstring,这个相当于string.h

.

1 回复
#2
书生牛犊2016-08-12 16:45
已解决,是函数名拼写错了


strcat


[此贴子已经被作者于2016-8-12 16:50编辑过]

1