Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MemoryMappedFile::CreateFromFile Method (String^)

.NET Framework (current version)
 

Creates a memory-mapped file from a file on disk.

Namespace:   System.IO.MemoryMappedFiles
Assembly:  System.Core (in System.Core.dll)

public:
static MemoryMappedFile^ CreateFromFile(
	String^ path
)

Parameters

path
Type: System::String^

The path to file to map.

Return Value

Type: System.IO.MemoryMappedFiles::MemoryMappedFile^

A memory-mapped file.

Exception Condition
ArgumentException

path is an empty string, contains only white space, or has one or more invalid characters, as defined by the Path::GetInvalidFileNameChars method.

-or-

path refers to an invalid device.

ArgumentNullException

path is null.

IOException

An I/O error occurred.

PathTooLongException

path exceeds the maximum length defined by the operating system. In Windows, paths must contain fewer than 248 characters, and file names must contain fewer than 260 characters.

SecurityException

The caller does not have the required permissions for the file.

The following example uses the CreateFromFile method to create a memory-mapped file, and then creates a memory-mapped view to a portion of an extremely large file.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 4.0
Return to top
Show:
© 2017 Microsoft