假设我们有两个数组:
double *matrix=new double[100];
double *array=new double[10];
Run Code Online (Sandbox Code Playgroud)
我们想要将矩阵[80:89]中的10个元素复制到数组中memcpy.
快速解决方案吗?
1)我使用Java调用Linux终端来运行foo.exe并将输出保存在文件中:
String[] cmd = {"/bin/sh", "-c", "foo >haha.file"};
Runtime.getRuntime().exec(cmd);
Run Code Online (Sandbox Code Playgroud)
2)问题是当我打算稍后在代码中阅读haha.file时,它尚未编写:
File f=new File("haha.file"); // return true
in = new BufferedReader(new FileReader("haha.file"));
reader=in.readLine();
System.out.println(reader);//return null
Run Code Online (Sandbox Code Playgroud)
3)只有在程序完成后才会写入haha.file.我只知道如何冲洗"作家",但不知道如何冲洗...... 像这样.如何强制java在终端中写入文件?
在此先感谢EE
我正在使用python2.5和scipy.weave嵌入c代码.
在我的c代码中,没有malloc()函数,但我收到的错误就像
"glibc detected *** python: malloc(): memory corruption"
Run Code Online (Sandbox Code Playgroud)
不时.(这是一个随机算法)
那我该怎么调试呢?
谢谢