-1

i know there are a couple of questions similar to this one out there but and while i have browsed through them, none have been able to resolve my problem. My code takes in three strings as parameters

on cmd

volume.exe NameOfInputFile.txt string1 string2

the code

int main(int argc, char* argv[])
{
   string s1=argv[2],s2=argv[3];
   fstream file;
   file.open(argv[1],ios::in);
   ..rest of the code..
}

this works fine on the terminal in linux as

./volume.exe NameOfInputFile.txt string1 string2

but how do i get it to work on windows? I tried this but did not work

start /b /d volume.exe NameOfInputFile.txt string1 string2
abhinonymous
  • 101
  • 2
  • I belive `start /b /d "volume.exe NameOfInputFile.txt string1 string2"` should work just fine. Why wouldn't it work? – mnmnc Jul 23 '14 at 10:05
  • The `/d` parameter is used to set a working directory. Try running this command instead: `start /b volume.exe NameOfInputFile.txt string1 string2` – and31415 Jul 23 '14 at 10:10
  • Neither `start /b volume.exe NameOfInputFile.txt string1 string2` works nor `start /b /d "C:..address.." volume.exe NameOfInputFile.txt string1 string2` – abhinonymous Jul 23 '14 at 10:15
  • where one doesn't know then the obvious thing is to simplify your test and try it without a file. like see if you can get working a program that just takes one string and displays it. basic troubleshooting – barlop Jul 23 '14 at 10:45
  • @barlop did that, didnt work, hence the post on superuser – abhinonymous Jul 23 '14 at 12:22
  • @abhinonymous If you did that and it didn't work, that means you had a simpler more concise, more clear, example to demonstrate the problem. You should have used that in your question, and you still can. – barlop Jul 23 '14 at 12:35
  • @abhinonymous furthermore, include how you have called the program. Your sample code doesn't even include any example in the ... that anybody could compile and quickly test. Besides the fact that according to you there is no need to include a file in the first place. – barlop Jul 23 '14 at 12:48

2 Answers2

0

Try this by surrounding the name of file NameOfInputFile.txt in quotes you pass it as string argument and not as a file.

start /b /d volume.exe "NameOfInputFile.txt" string1 string2
user3793099
  • 101
  • 2
0

Try this one:

start /b /d "volume.exe NameOfInputFile.txt string1 string2"
deming
  • 101