我该怎么做才能让我的C脚本可以执行二进制文件?

时间:2016-02-06 02:15:00

标签: c shell

所以我做了gcc -Wall -o file file.c,我的程序与echo abc | ./file一起使用,但是当我尝试sh file abc时,它说file : file cannot execute binary file,我该怎么做才能解决这个问题?我的C原型是int main(int argc, char **argv),不确定这是否有帮助。

谢谢!

2 个答案:

答案 0 :(得分:0)

您尝试将文件(即已编译的可执行文件)作为shell脚本执行。这不起作用。你的意思是

sparse_labels = tf.reshape(label_batch, [-1, 1])
derived_size = tf.shape(sparse_labels)[0]
indices = tf.reshape(tf.range(0, derived_size, 1), [-1, 1])
concated = tf.concat(1, [indices, sparse_labels])
outshape = tf.concat(0, [tf.reshape(derived_size, [1]), tf.reshape(num_labels, [1])])
labels = tf.sparse_to_dense(concated, outshape, 1.0, 0.0)

答案 1 :(得分:0)

  • 您的file不是脚本,而是二进制文件。
  • 尝试使用sh执行它意味着它是一个sh / bash脚本。
  • 尝试使用./file
相关问题