小编Oph*_*rmi的帖子

'long long'的格式说明符

我为64位计数器声明一个变量:

long long call_count;
Run Code Online (Sandbox Code Playgroud)

我应该在print语句中使用什么格式说明符?

我试过了,%l,%ld,%ll.似乎没有一个是正确的.

我使用Diab C编译器来编译我的应用程序代码以在pSOS操作系统上运行.

c

39
推荐指数
4
解决办法
7万
查看次数

如何设置 Wayland 窗口在屏幕上的位置?

wayland我不知道如何设置窗口在屏幕上的位置。

似乎它是以某种方式设置的,因为在我的电脑上,窗口似乎位于重复的位置。

我尝试了如何在 Weston 背景中设置 Wayland 客户端表面的位置?

但它使我的 Ubuntu 18.04 崩溃(让我退出)。

我写了一个在窗口中显示图像的示例。图像已显示,但我希望能够以编程方式设置其在屏幕上的位置。原始图像在这里

编译用gcc wayland_example.cpp -lwayland-client -o wayland_example

运行与./wayland_example <path_to_image>

#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
#include <memory.h>
#include <wayland-client.h>

static struct wl_display *display = nullptr;
static struct wl_compositor *compositor = nullptr;
static struct wl_surface *surface;
static struct wl_shell *shell;
static struct wl_shell_surface *shell_surface;
static struct wl_shm *shm;
static struct wl_buffer *buffer;
static struct wl_callback *frame_callback;
static …
Run Code Online (Sandbox Code Playgroud)

c wayland

8
推荐指数
2
解决办法
7941
查看次数

使用fseek回溯

使用fseek原路返回字符fscanf操作可靠吗?

例如,如果我只有fscanf10个字符,但我想回溯10个字符,我可以fseek(infile, -10, SEEK_CUR)吗?

它适用于大多数情况,但我似乎对角色有问题^M.显然fseek将它注册为char但fscanf不注册它,因此在我之前的示例中,包含a的10个char块^M将需要fseek(infile, -11, SEEK_CUR).fseek(infile, -10, SEEK_CUR)会使它缩短1个字符.

为什么会这样?

编辑:我fopen在文本模式下使用

c file-io fseek

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

RcppShark Random Forest示例抛出有关随机数生成器的异常

我按照这个例子:

https://www.2021.ai/randsharkmachinelearning/

在R上运行此命令时:

sharkFit <- SharkRFTrain(X, Y, nTrees = 100)
Run Code Online (Sandbox Code Playgroud)

我明白了:

Error in SharkRFTrain(X, Y, nTrees = 100) : 
  Should not call this. Fix the random numbers generator if you need this. 478
Run Code Online (Sandbox Code Playgroud)

从这个"cpp"行抛出此异常:

trainer.train(model, trainData);
Run Code Online (Sandbox Code Playgroud)

我怀疑原因写在这里:

https://github.com/aydindemircioglu/RcppShark#notes

随机数生成器被替换,因为R包必须使用R中的随机生成器而不是C/C++内部生成器.因此,不能进行依赖于(伪)随机数的算法结果的直接比较.

有没有办法缓解这种情况?

尝试了两个R版本:3.4.1,3.3.2

c++ r machine-learning random-forest shark-ml

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

标签 统计

c ×3

c++ ×1

file-io ×1

fseek ×1

machine-learning ×1

r ×1

random-forest ×1

shark-ml ×1

wayland ×1