C ++中的系统调用 [英] system calls in C++

查看:148
本文介绍了C ++中的系统调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

pls将其转换为Visual Studio C ++

pls convert this into visual studio c++

package com.proxim.db;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Example {

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        try {
            Process p  = Runtime.getRuntime().exec("ipconfig");
            BufferedReader stdInput = new BufferedReader(new
                    InputStreamReader(p.getInputStream()));
                            System.out.println("Here is the standard output of the command:\n");
                            int count =0;
                            String s, result ="";
                           while (!procDone(p)) {
                            while((s=stdInput.readLine()) !=null){
                                    count++;
                                    result = result+s+"\n";
                                    System.out.println("result:"+count+": "+result);

                            }
                           }
                            stdInput.close();


            //System.out.println(proc.getOutputStream().toString());
        } catch (Exception e) {
            // TODO: handle exception
        }
    }
    private static boolean procDone(Process p) {
        try {
            int v = p.exitValue();
            return true;
        }
        catch(IllegalThreadStateException e) {
            return false;
        }
    }
}

推荐答案

那是什么问题?请不要发布对代码的要求,此站点是在这里帮助自助的人,而不是免费做您的工作.
What sort of question is that? Please do not post demands for code, this site is here to help people who help themselves, not to do your work for free.


自己进行转换您需要的代码.
:)
Please do convert yourself the code you need.
:)


不,谢谢!我希望您自己做!无论如何,我都会给您一个提示:请参阅 CreateProcess函数(Windows ) [ ^ ],并注意lpStartupInfo参数.
No, thank you! I prefer that you do it by yourself! Anyway I give you an hint: have a look at the documentation of the CreateProcess Function (Windows)[^] and pay attention to the lpStartupInfo parameter.


这篇关于C ++中的系统调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆