我以前没有与固定图书馆合作,但现在我需要这样做。
Scenario:
我写的是“九”的圣经。 I free use std:string
各地都很容易这样做。 然而,我最近发现,我不得不在Windows支持它,第三方申请需要我的密码的APICS(我不会分享来源,而只是DL)。
有鉴于此,我仍可使用<代码>t:string。 我的法典在任何地方,但随后又向它们提供<条码>。 char * , 当我对APICS进行编码时? 这一工作吗?
我以前没有与固定图书馆合作,但现在我需要这样做。
我写的是“九”的圣经。 I free use std:string
各地都很容易这样做。 然而,我最近发现,我不得不在Windows支持它,第三方申请需要我的密码的APICS(我不会分享来源,而只是DL)。
有鉴于此,我仍可使用<代码>t:string。 我的法典在任何地方,但随后又向它们提供<条码>。 char * , 当我对APICS进行编码时? 这一工作吗?
Yep. 使用<代码>std:string <>/code> Internal and subsequently only use const char *
on the界面功能 (该功能将改为std:string
s on content.
Why not just provide them with std::string?
It s standard C++, and I d be very suprised if they didn t support it.
问题在于,你的客户将做些什么。 当然,它应当是const char*
,但如果客户稍后将保留和提及,那么它很可能有使用 st的风险:在内部进行扼杀,因为一旦你在座标上运作,就没有办法 keep住:由于其参考计数机制不能与出口果点*打交道,所以从记忆转移。 只要你会触及到 st子:扼杀物体,他们的记忆会胜出,点子是安全的。
没有标准化的C++双向接口(至少是我本国;没有听说过这种接口),因此,不同环境的项目似乎无法连接在一起。 例如,视觉C++提供了一种能够提供/可处置的消减器支持的途径。 这受到一些数据结构的宏观和规模的控制。
如果用不同环境汇编的两种代码开始使用这些数据结构进行交流,那么你所能掌握的最佳东西就是链接错误。 其他替代物则更糟——稳定运行时间错误、只有释放组合的错误等等。
因此,如果你不想将用户限制在单一正确的项目环境设置和汇编版本上,则只使用原始数据进行接口。 内部执行选择更方便之处。
Adding to Poita_ s response:
consider unicode support If you ever have to support localization, too, you ll be happy to have done it in the first place
when returning char/wchar_t const *, define the lifetime of the data. The best would be to have a project-wide "unless stated otherwise..." standard
Alternatively, you can return a copy that must be freed through a method exported by your library. (C++ clients can move that into a smart pointer to regain automatic memory management.)
st:至少在视觉演播室C++(及其他)中,将加以扼杀,因此不单纯利用?
I have a simple problem that says: A password for xyz corporation is supposed to be 6 characters long and made up of a combination of letters and digits. Write a program fragment to read in a string ...
The == operator is used to compare two strings in shell script. However, I want to compare two strings ignoring case, how can it be done? Is there any standard command for this?
I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...
I tried to print all the possible combination of members of several vectors. Why the function below doesn t return the string as I expected? #include <iostream> #include <vector> #...
I m trying to initialize string with iterators and something like this works: ifstream fin("tmp.txt"); istream_iterator<char> in_i(fin), eos; //here eos is 1 over the end string s(in_i, ...
I have a string "pc1|pc2|pc3|" I want to get each word on different line like: pc1 pc2 pc3 I need to do this in C#... any suggestions??
Is there a PHP string function that transforms a multi-line string into a single-line string? I m getting some data back from an API that contains multiple lines. For example: <p>Some Data</...
I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...