小编use*_*993的帖子

将const char*转换为NSString*并转换回来 - _NSAutoreleaseNoPool()

我正在尝试将const char*转换为NSString*然后将其转换回来.它有效,但我得到:

__NSAutoreleaseNoPool(): Object 0x100550a40 of class NSCFArray autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x100551730 of class NSCFString autoreleased with no pool in place - just leaking
__NSAutoreleaseNoPool(): Object 0x100551f10 of class NSCFData autoreleased with no pool in place - just leaking
Run Code Online (Sandbox Code Playgroud)

代码是:

const char* convert = "hello remove this: *";

NSString *input = [[NSString alloc] initWithUTF8String:convert];// convert 

//remove * FROM THE STRING          
NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"*"]; 

// REPLACE * WITH NOTHING                   
input = …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c

6
推荐指数
1
解决办法
2万
查看次数

C和C++中的套接字解​​释

好吧,我一直想知道是否有一个标准的C++套接字头文件

我确实搜索了整个互联网(使用谷歌搜索引擎),但找不到任何标准的C++套接字头文件,除了找到一些库,如Boost,chilkat等...

我只是成功地为C编程语言找到了一个标准的套接字头文件.如果我使用C标准套接字头文件,但在我的C++代码中,是否意味着我的程序是纯C++或C和C++?

因为我没有找到任何标准的C++套接字头文件.就像有<string>C++和<string.h>C一样,但C++没有套接字标准头文件.

我希望C/C++聪明的人能够一步一步地为我解释所有这些.

c c++ sockets

4
推荐指数
1
解决办法
2364
查看次数

发送Http"发布"请求到C或C++中的Php代码

我正在尝试向我的php文件发送"post"reguest并获取信息,它工作正常,但是

它还会在从php文件打印我的响应之前打印一些东西.这就是它的印刷品

第一:

HTTP/1.1 200 OK
Date: Fri, 20 Apr 2012 10:19:12 GMT
Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 PHP/5.3.6
X-Powered-By: PHP/5.3.6
Content-Length: 12
Connection: close
Content-Type: text/html

然后我的回答:

hello world

我怎么能只打印我从myphp代码中得到的东西,没有:

HTTP/1.1 200 OK
Date: Fri, 20 Apr 2012 10:19:12 GMT
Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 PHP/5.3.6
X-Powered-By: PHP/5.3.6
Content-Length: 12
Connection: close
Content-Type: text/html

我正在使用的代码是:

#include <arpa/inet.h>
#include <assert.h>
#include <errno.h>
#include <netinet/in.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h> …
Run Code Online (Sandbox Code Playgroud)

php c c++ sockets http

1
推荐指数
1
解决办法
1万
查看次数

推送数组数据并找到数组的索引

我如何创建一个空数组,我可以推送用户信息,如:

$users->set('bob', array('email' => 'bob@site.com', 'password' => '123456'));
$users->set('joe', array('email' => 'joe@site.com', 'password' => 'test'));
Run Code Online (Sandbox Code Playgroud)

并检索/读取我想要读取的键,如:

$user = $users->get('bob');
echo 'Bob, your email is ' . $user['email'];
Run Code Online (Sandbox Code Playgroud)

并且还能够检索所有关键名称

$keys = $users->getKeys(); 
Run Code Online (Sandbox Code Playgroud)

我搜索过谷歌,但一切都没有用.请告诉我如何才能了解更多..

PS:学习如何从数组中删除键也很好:

// Delete a key
$users->delete('joe');
Run Code Online (Sandbox Code Playgroud)

php

1
推荐指数
1
解决办法
49
查看次数

Firebase iOS SDK - 计算已连接的用户

我正在使用Firebase iOS SDK构建一个聊天系统,让我的用户可以连接到他们可以在一起聊天的一些随机"房间".在房间内,我想向他们显示当前连接的总人数.问题是我不知道该怎么做.应在特定用户的连接和断开连接上更新连接的用户数.我不知道从哪里开始和做什么.

objective-c ios firebase swift

1
推荐指数
1
解决办法
946
查看次数

NSString返回不起作用

我的代码不起作用,我不知道为什么

以下作品:

NSString *  words (void) {


    return [NSString stringWithFormat:@"You sent %d words\n", 1];

}
Run Code Online (Sandbox Code Playgroud)

但这不起作用:

NSString *  words (void) {

    return  [[[NSString alloc] stringWithFormat:@"You have %d words\n", 1] autorelease];

}
Run Code Online (Sandbox Code Playgroud)

怎么了,当我发布它时,它就不会工作了.请帮帮我.

xcode objective-c

-1
推荐指数
1
解决办法
111
查看次数

转换为const int

如何将int的值复制到新的const int?

由此:

int start= 343;
Run Code Online (Sandbox Code Playgroud)

进入这个:

const int end = start;
Run Code Online (Sandbox Code Playgroud)

如何做到这一点,任何一个例子?我真的不知道如何,请帮助我 -

c c++

-3
推荐指数
1
解决办法
5529
查看次数

标签 统计

c ×3

c++ ×3

objective-c ×3

php ×2

sockets ×2

xcode ×2

firebase ×1

http ×1

ios ×1

swift ×1