小编Cas*_*sio的帖子

为什么这段代码能够正常运行并给出正确的结果?

我有两个文件,一个叫做N.bin,另一个叫做R.bin.经过几个月的使用,我只是注意到我在那里犯了一个错误.但是,我认为系统会因此而崩溃.但首先它没有,第二个它给出了正确的结果.这是代码:

请参阅第19行,我如何错误地从Nfile流入而不是Rfile.

//读取文件N.

1       long world_features_lSize;
2       FILE* NFile;
3       double* N;
4       NFile=fopen("N.bin","r+b");
5   
6       fseek (NFile , 0 , SEEK_END);
7       lSize = ftell (NFile);
8       fseek (NFile , 0 , SEEK_SET);
9       N = (double*) malloc (sizeof(double)*lSize);
10      result = fread (N,1,lSize,NFile);
11      fclose(NFile);
    ////////////////// Read R

12      FILE* RFile;
13      double* R;
14      RFile=fopen("R.bin","r+b");

15      fseek (RFile , 0 , SEEK_END);
16      lSize = ftell (RFile);
17      fseek (RFile , 0 , SEEK_SET);
18      R = …
Run Code Online (Sandbox Code Playgroud)

c fopen fread

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

java中的Long数据类型出错

实际上我的系统将Long.MAX_VALUE设为9223372036854775807

但是当我写这样的程序时,

package hex;

/**
 *
 * @author Ravi
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here

        long x = 9223372036854775807;

        System.out.println(x);

    }

}
Run Code Online (Sandbox Code Playgroud)

我收到编译时错误.任何人都可以解释原因吗?

java

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

[Freebase]:查找节点之间的关系

我是Freebase的新手,我一直试图找到2个节点之间的关系而没有成功.

例如,我想找出Lewis Hamilton(/ en/lewis_hamilton)和一级方程式(/ en/formula_one)之间是否存在链接,这在现实生活中是如此,但我似乎无法找到它.

我尝试了以下MQL代码,也是交替ID:

1)

[{ 
 "type" : "/type/link", 
 "source" : { "id" : "/en/lewis_hamilton" }, 
 "master_property" : null, 
 "target" : { "id" : "/en/formula_one" }, 
 "target_value" : null 
}]
Run Code Online (Sandbox Code Playgroud)

2)

{
  "id":"/en/lewis_hamilton",
  "/type/reflect/any_master":[{
    "link":null,
    "name":null
  }],
  "/type/reflect/any_reverse":[{
    "link":null,
    "name":null
  }],
  "/type/reflect/any_value":[{
    "link":null,
    "value":null
  }]
}
Run Code Online (Sandbox Code Playgroud)

我也无法使用他们可以执行此操作的几个应用程序,因为它每次都返回"超出用户速率限制".应用程序是:

  1. http://between.freebaseapps.com
  2. http://shortestpath.freebaseapps.com

你们有什么建议吗?

freebase semantic-web mql

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

标签 统计

c ×1

fopen ×1

fread ×1

freebase ×1

java ×1

mql ×1

semantic-web ×1