小编ppk*_*ppk的帖子

如何正确编码此URL

我试图使用JSoup获取此URL

http://betatruebaonline.com/img/parte/330/CIGUEÑAL.JPG

即使使用编码,我也有例外.我不明白为什么编码错了.它回来了

http://betatruebaonline.com/img/parte/330/CIGUEN%C3%91AL.JPG

而是正确的

http://betatruebaonline.com/img/parte/330/CIGUEN%CC%83AL.JPG

我怎么解决这个问题?谢谢.

private static void GetUrl()
{
    try
    {
        String url = "http://betatruebaonline.com/img/parte/330/";
        String encoded = URLEncoder.encode("CIGUEÑAL.JPG","UTF-8");
        Response img = Jsoup
                            .connect(url + encoded)
                            .ignoreContentType(true)
                            .execute();

        System.out.println(url);
        System.out.println("PASSED");
    }
    catch(Exception e)
    {
        System.out.println("Error getting url");
        System.out.println(e.getMessage());
    }
}
Run Code Online (Sandbox Code Playgroud)

java jsoup

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

如何在C++中正确地将vector <int>传递给pthread_create?

我想创建一个传递vector作为参数的线程.但我得到以下错误:

error: invalid conversion from ‘int’ to ‘void* (*)(void*)’ [-fpermissive]

error: initializing argument 3 of ‘int pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*), void*)’ [-fpermissive]

我有以下代码:

#include <iostream>
#include <vector>
#include <pthread.h>

using namespace std;

void* func(void* args)
{
    vector<int>* v = static_cast<vector<int>*>(args);
    cout << "Vector size: " << v->size();
}

int main ( int argc, char* argv[] )
{

  vector<int> integers;
  pthread_t thread;


      for ( int i = 0; i < 10; i++)
        integers.push_back(i+1);

       // overheat call
       //pthread_create( &thread, NULL, func, …
Run Code Online (Sandbox Code Playgroud)

c++ linux pthreads

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

标签 统计

c++ ×1

java ×1

jsoup ×1

linux ×1

pthreads ×1