EDIT: The following code is run through Microsoft Visual Studio 2013
I have the following script:
#include "stdafx.h"
#include <iostream>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: tut1 path\n";
return 1;
}
std::cout << argv[1] << std::endl;
std::cout << "File Size is: " << file_size(argv[1]) << std::endl;
return 0;
}
But when I run it with ctrl+f5
, I get this message (which is predicted by an if-condition in the code itself:
Usage: tut1 path
It seems the number of arguments is lower than 2.
Why this happens? How should I avoid this problem?
EDIT:
When I remove the following line:
std::cout << "File Size is: " << file_size(argv[1]) << std::endl;
I get the "Filing.cpp" printed on my console which means
argv[0]
value is Filing.cpp that further shows argv
is getting the commands from command arguments of Debuger of project correctly.
But when I add the line again, I see the message "Filing.exe not found or not built by the last incremental link;"