-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
7
  • I belive start /b /d "volume.exe NameOfInputFile.txt string1 string2" should work just fine. Why wouldn't it work?
    – mnmnc
    Jul 23, 2014 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, 2014 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 Jul 23, 2014 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, 2014 at 10:45
  • @barlop did that, didnt work, hence the post on superuser Jul 23, 2014 at 12:22

2 Answers 2

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
0

Try this one:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .