user6844151
user6844151

Reputation:

How to use File::ReadAllBytes in visual c++?

Visual Studio has a simple method "File::ReadAllBytes" that will read a file and return a byte array, but I don't know how to use it. I tried the following and they all don't work.

Byte arr[] = File::ReadAllBytes("file.txt");
Byte *arr = File::ReadAllBytes("file.txt");
unsigned char arr[] = File::ReadAllBytes("file.txt");
unsigned char *arr = File::ReadAllBytes("file.txt");

unsigned char *arr;
arr = File::ReadAllBytes("file.txt");

Upvotes: 1

Views: 987

Answers (1)

File::ReadAllBytes is a .NET function, so you cannot call it from C++.

You can call it from C++/CLI (Microsoft's .NET version of C++), but you have clarified that you are not using C++/CLI.

Upvotes: 1

Related Questions