In the following example I am trying to open a file that I have named in the command line for Read. Does anyone have any suggestions?
==========================================

#include "stdafx.h"
#include <fstream>
#include <iostream>

using namespace System;
using namespace System::IO;
using namespace System::Text;
using namespace std;

#define RSIZE 1			// Buffer size

int main( int  argc,      // Number of strings in array argv
          char *argv[],   // Array of command-line argument strings
          char *envp[] )  // Array of environment variable strings
{
	{
    int count;

    // Display each command-line argument.
    cout << "\nCommand-line arguments:\n";
    for( count = 0; count < argc; count++ )
         cout << "  argv[" << count << "]   "
                << argv[count] << "\n";
	}

 String^ kpath =  ToString(argv[1]);
 // <<<<<< error C3861 "'ToString': idenifier not found"	
   
  FileStream^ kfs = File::OpenRead( kpath );
  long long kL = kfs->Length;

  array<Byte>^ib = gcnew array<Byte>(RSIZE); // array of 1 bytes   

	try
	{
		  Console::Write(kL);
		  for (int i; i < kL; i++){
			ifs->Read(kb, 0, RSIZE);
			Console::Write(Convert::ToChar(kb[0]));
		  }
		  
	}
      finally
      {
        if ( kfs )
            delete (IDisposable^)kfs;
      }
}
// -eof-

==========================================

Thank You in advance for any help!

how would one convert from argv[1] to 'System::String ^'?

I had to look this up so I'm not much good on further questions :) String ^ kpath = gcnew String(argv[1]); It makes sense to me but I don't have much experience with the CLI syntax.

I had to look this up so I'm not much good on further questions :) String ^ kpath = gcnew String(argv[1]); It makes sense to me but I don't have much experience with the CLI syntax.

Yes, this seems to work. Thank you *VERY* much!

At least it compiles!

I will see what I can do with it!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.