Advertisement
skyzero

Assignment-1

Jan 10th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. /*Name : FERRY FERDIAN
  2. Class : IT1 - 2010
  3. StudentID : 001201000037
  4. Subject : Network Programming
  5. */
  6.  
  7. #include <iomanip>
  8. #include <iostream>
  9. #include <string>
  10. #include <windows.h>
  11. #include <unistd.h>
  12. using namespace std;
  13.  
  14. string getexepath()
  15.   {
  16.   char result[ MAX_PATH ];
  17.   return string( result, GetModuleFileName( NULL, result, MAX_PATH ) );
  18.   }
  19.  
  20. int main( int argc, char* argv[] )
  21.   {
  22.   cout << "The name used to start the program: " << argv[ 0 ]
  23.        << "\nArguments are:\n";
  24.   for (int n = 1; n < argc; n++)
  25.     cout << setw( 4 ) << n << ": " << argv[ n ] << '\n';
  26.  
  27.     cout << "\nThe path of the file: "  << getexepath() << "\n\n";
  28.  
  29.     char directory[_MAX_PATH];
  30.     getcwd(directory, sizeof(directory));
  31.     cout<< "The current working directory is: " << directory << "\n\n";
  32.     return 0;
  33.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement