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

求解释~~~~ 'strncpy' : is not a member of 'std'

Is不白惨嘿 发布于 2013-03-19 11:02, 814 次点击
void Stock::acquire(const char * co,int n,double pr)
{
    std::strncpy(company,co,29);
    company[29]='\0';
    if(n<0)
    {
        std::cerr<<"Number of shares can't be negative."
    <<company<<"shares set to 0.\n";
    shares=0;
    }
    else
        shares=n;
    share_val=pr;
    set_tot();
}




K:\stocks\stocks.cpp(22) : error C2039: 'strncpy' : is not a member of 'std'
执行 cl.exe 时出错.

stocks.obj - 1 error(s), 0 warning(s)
3 回复
#2
rjsp2013-03-19 11:04
'strncpy' : is not a member of 'std'
说得很清呀,没有 std::strncpy,只有 ::strncpy
#3
peach54602013-03-19 11:11
yes
#4
Is不白惨嘿2013-03-19 11:27
回复 2楼 rjsp
恩恩     可以通过了   不过有点疑惑  ::strncpy和这个std::cerr   区别怎么讲???
1