0

Say I had the following Java Method, in the class "Reader":

public static String read(String filePath) {  
    BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(filePath))));
    String contents = "";
    String line = null;

    while ((line = br.readLine()) != null) {
        contents += "\r\n" + line;
    }

    return contents;
}

How would I use C++ to execute Reader.read("PathToFile")? I need to be able to pass it the path to the file, and get the result.
I know I can execute it using System(), but as far as I know, you cannot pass it a value through the command prompt. Nor can you receive a result

user6615347
  • 101
  • 1
  • 7
  • What information have your exhaustive searches brought you? Please add this information to your question to make it more specific and thus more answerable. – Hovercraft Full Of Eels Jun 08 '17 at 23:02
  • Hovercraft Full Of Eels I disagree with you that this question was not clear. For me the question is crystal clear, the user wants to call a very specific Java function using a C++ environment and wonders how to do this. – Pedro Jun 08 '17 at 23:58
  • @Pedro: you misread my comment if you thought that the question is not clear. It's clear but it's far too broad, and shows no evidence of prior effort or research on a subject that has been answered many times on this and other sites. The OP is always obliged to first search on a subject before asking. If you hover over the down-vote arrow you'll see that the first reason for clicking it is, "the question does not show any research effort...". Please tell me, where is there **any** evidence of research effort in this question? – Hovercraft Full Of Eels Jun 09 '17 at 00:44

0 Answers0