Visual C++ .NET/Development/main

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Passing parameters to main()

 
#include "stdafx.h"
using namespace System;
int main ( int argc, char *argv[] )
{
    Console::WriteLine ( argc.ToString() );
    for (int i = 0; i < argc; i++)
    {
        Console::WriteLine ( gcnew String(argv[i]) );
    }
    return 0;
}


Passing parameters to main() new method

 
#include "stdafx.h"
using namespace System;
int main(array<System::String ^> ^args){
    Console::WriteLine(args->Length);
  
    for each (String^ s in args)
    {
        Console::WriteLine(s);
    }
    return 0;
}