Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

The getting started sample demonstrates how to perform common tasks using the Azure File Service in C++ including creating a directory, uploading files to a directory, downloading files, as well as listing all the files in a directory.

License

Notifications You must be signed in to change notification settings

Azure-Samples/storage-file-cpp-getting-started

services platforms author
storage
cpp
seguler

Azure Storage File Service Samples in C++

Demonstrates how to use the File Service.

  • Azure File Storage offers shared storage for legacy applications using the standard SMB protocol. Azure virtual machines and cloud services can share file data across application components via mounted shares, and on-premises applications can access file data in a share via the File service REST API..

Note: This sample uses the Windows Azure Storage client library for C++ available through a Nuget package, which depends on the Visual Studio version you will use for development. For Visual Studio 2015, use the Nuget package "wastorage.v140". For Visual Studio 2013, use "wastorage.v120".

If you don't have a Microsoft Azure subscription you can get a FREE trial account here.

Running this sample in Windows

This sample can be run using an Azure Subscription. The sample will prompt the user to enter an account name and key.

Note: The sample will download files to 'downloadfolder' in local environment where it is run and upload files to 'targetfolder' in your Azure Storage account. These folders can be changed in getting_started.cpp.

To run the sample using Visual Studio:

  1. Create a Storage Account through the Azure Portal and note down your account name and account key.
  2. Set breakpoints and run the project using F10.
  3. Enter in your account name and key when prompted.

Running this sample in Linux

In order to compile and run this sample in Linux, you first need to get a local copy of the C++ REST SDK (aka Casablanca) from [here] (https://github.com/Microsoft/cpprestsdk/wiki/How-to-build-for-Linux) and the Azure Storage Client Library for C++ from [here] (https://github.com/Azure/azure-storage-cpp). Both libraries must be compiled following the instructions described in the corresponding Github repositories. Once you have these libraries, follow these instructions to build the samples,

  • Clone the project using git:
git clone https://github.com/Azure-Samples/storage-file-cpp-getting-started.git

The project is cloned to a folder called storage-file-cpp-getting-started. Always use the master branch, which contains the latest release.

  • Build the samples:
cd storage-file-cpp-getting-started/storage-File-cpp-getting-started
export AZURESTORAGE_DIR=<path to azure-storage-cpp library>
cmake .
make

The sample is generated under storage-file-cpp-getting-started/Binaries/.

More information

About

The getting started sample demonstrates how to perform common tasks using the Azure File Service in C++ including creating a directory, uploading files to a directory, downloading files, as well as listing all the files in a directory.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published