Click or drag to resize
GDFileIOWriteBufferAsync Method
Writes data from a buffer to the specified file.

Namespace:  GD
Assembly:  GD (in GD.dll) Version: 255.255.255.255
Syntax
public static IAsyncAction WriteBufferAsync(
	IGDStorageFile file,
	IBuffer buffer
)

Parameters

file
Type: GDIGDStorageFile
The file that the buffer of data is written to.
buffer
Type: Windows.Storage.StreamsIBuffer
The buffer that contains the data to write.

Return Value

Type: IAsyncAction
No object or value is returned when this method completes.
Examples
The following example shows how to write buffer to file in the SDK secure storage.
using GD;
...
try
{
    var file = await GDWindows.Instance.SecureFolder.CreateFileAsync("foo.bar");
    if (file != null)
    {
        IBuffer buffer = GetBufferFromString("Swift as a shadow");
        await GDFileIO.WriteBufferAsync(file, buffer);
        // Perform additional tasks after file is written
    }
}
// Handle errors with catch blocks
catch (FileNotFoundException)
{
    // For example, handle file not found
}
See Also