如何传递一个向量到execvp [英] How to pass a vector to execvp
本文介绍了如何传递一个向量到execvp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想传递一个向量作为execvp的第二个参数。可能吗?
I want to pass a vector in as the second argument to execvp. Is it possible?
推荐答案
不直接;你需要将向量表示为一个NULL终止的字符串指针数组。如果它是一个字符串的向量,这是直接做;如果它是一些其他类型的数据,你将不得不说明如何将其编码为字符串。
Not directly; you'd need to represent the vector as a NULL-terminated array of string pointers somehow. If it's a vector of strings, that is straightforward to do; if it's some other kind of data you would have to figure how to encode it as strings.
这篇关于如何传递一个向量到execvp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文