看似简单任务

zengfanhua 2003-04-23 04:05:16
错误:
[C++ Error] E2268 Call to undefined function 'StringOfChar'

我用bc6,在bc6帮助中有此StringOfChar 函数,但编译出错如上。

程序包含 vc1.h ,iostream.h ,string.

为什么没定义 ?
...全文
20 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
僵哥 2003-04-23
  • 打赏
  • 举报
回复
StringOfChar是AnsiString成员函数.
Lersh 2003-04-23
  • 打赏
  • 举报
回复
被楼上的抢先了……楼主行行好,把分给我吧,1楼的也不在乎这20分吧
xabcxyz 2003-04-23
  • 打赏
  • 举报
回复
这是我查到的帮助:

Returns a string with the specified number of characters.

static AnsiString __fastcall StringOfChar(char ch, int count);

Description

StringOfChar returns a string containing count characters with the character value given by ch. For example,

AnsiString s = AnsiString::StringOfChar('A', 10);

sets s to the string "AAAAAAAAAA".



它是AnsiString的成员函数,独立使用当然没有定义,建议使用:

Header File

mem.h, string.h

Category

Memory and String Manipulation Routines, Inline Routines

Prototype

void *memset(void *s, int c, size_t n);

void *_wmemset(void *s, int c, size_t n);

Description

Sets n bytes of a block of memory to byte c.

memset sets the first n bytes of the array s to the character c.

Return Value

memset returns s.
Lersh 2003-04-23
  • 打赏
  • 举报
回复
这样调用:
AnsiString::StringOfChar
TopCat 2003-04-23
  • 打赏
  • 举报
回复
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString s = AnsiString::StringOfChar('X', 10);
ShowMessage(s);
}

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧