You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hub/apps/develop/files/create-read-write-files.md
+1-69Lines changed: 1 addition & 69 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,8 +9,6 @@ ms.localizationpriority: medium
9
9
dev_langs:
10
10
- csharp
11
11
- cppwinrt
12
-
- cpp
13
-
- vb
14
12
---
15
13
# Create, write, and read a file
16
14
@@ -29,7 +27,7 @@ Read and write a file using a [StorageFile](/uwp/api/windows.storage.storagefile
29
27
30
28
-**Understand async programming for WinUI apps**
31
29
32
-
You can learn how to write asynchronous apps in C# or Visual Basic, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++/WinRT, see [Concurrency and asynchronous operations with C++/WinRT](/windows/uwp/cpp-and-winrt-apis/concurrency).
30
+
You can learn how to write asynchronous apps in C#, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++/WinRT, see [Concurrency and asynchronous operations with C++/WinRT](/windows/uwp/cpp-and-winrt-apis/concurrency).
33
31
34
32
-**Know how to get the file that you want to read from, write to, or both**
2. Next, getanoutputstreambycallingthe [IRandomAccessStream.GetOutputStreamAt](/uwp/api/windows.storage.streams.irandomaccessstream.getoutputstreamat) methodfromthe `stream`. Ifyou're using C#, then enclose this in a using statement to manage the output stream'slifetime. Ifyou're using [C++/WinRT](/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt), then you can control its lifetime by enclosing it in a block, or setting it to `nullptr` when you'redonewithit.
199
174
@@ -211,11 +186,6 @@ Await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Swift as a shadow")
211
186
```
212
187
213
188
214
-
```vb
215
-
UsingoutputStream=stream.GetOutputStreamAt(0)
216
-
' We'lladdmorecodehereinthenextstep.
217
-
EndUsing
218
-
```
219
189
220
190
3. Nowaddthiscode (ifyou're using C#, within the existing using statement) to write to the output stream by creating a new [DataWriter](/uwp/api/windows.storage.streams.datawriter) object and calling the [DataWriter.WriteString](/uwp/api/windows.storage.streams.datawriter.writestring) method.
221
191
@@ -233,10 +203,6 @@ Await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Swift as a shadow")
233
203
```
234
204
235
205
236
-
```vb
237
-
DimdataWriterAsNewDataWriter(outputStream)
238
-
dataWriter.WriteString("DataWriter has methods to write to various types, such as DataTimeOffset.")
239
-
```
240
206
241
207
4. Lastly, addthiscode (ifyou're using C#, within the inner using statement) to save the text to your file with [DataWriter.StoreAsync](/uwp/api/windows.storage.streams.datawriter.storeasync) and close the stream with [IOutputStream.FlushAsync](/uwp/api/windows.storage.streams.ioutputstream.flushasync).
242
208
@@ -251,10 +217,6 @@ Await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Swift as a shadow")
251
217
```
252
218
253
219
254
-
```vb
255
-
AwaitdataWriter.StoreAsync()
256
-
AwaitoutputStream.FlushAsync()
257
-
```
258
220
259
221
**Bestpracticesforwritingtoafile**
260
222
@@ -277,10 +239,6 @@ auto sampleFile{ co_await storageFolder.GetFileAsync(L"sample.txt") };
@@ -375,9 +320,6 @@ Dim text As String = Await Windows.Storage.FileIO.ReadTextAsync(sampleFile)
375
320
```
376
321
377
322
378
-
```vb
379
-
Dimsize=stream.Size
380
-
```
381
323
382
324
3. Getaninputstreambycallingthe [IRandomAccessStream.GetInputStreamAt](/uwp/api/windows.storage.streams.irandomaccessstream.getinputstreamat) method. Putthisinausingstatementtomanagethestream's lifetime. Specify 0 when you call GetInputStreamAt to set the position to the beginning of the stream.
383
325
@@ -395,11 +337,6 @@ Dim text As String = Await Windows.Storage.FileIO.ReadTextAsync(sampleFile)
395
337
```
396
338
397
339
398
-
```vb
399
-
UsinginputStream=stream.GetInputStreamAt(0)
400
-
' We'lladdmorecodehereinthenextstep.
401
-
EndUsing
402
-
```
403
340
404
341
4. Lastly, addthiscodewithintheexistingusingstatementtogeta [DataReader](/uwp/api/windows.storage.streams.datareader) objectonthestreamthenreadthetextbycalling [DataReader.LoadAsync](/uwp/api/windows.storage.streams.datareader.loadasync) and [DataReader.ReadString](/uwp/api/windows.storage.streams.datareader.readstring).
405
342
@@ -417,11 +354,6 @@ Dim text As String = Await Windows.Storage.FileIO.ReadTextAsync(sampleFile)
Copy file name to clipboardExpand all lines: hub/apps/develop/files/determine-availability-microsoft-onedrive-files.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ Determine if a Microsoft OneDrive file is available using the [StorageFile.IsAva
22
22
23
23
-**Understand async programming for WinUI apps**
24
24
25
-
You can learn how to write asynchronous apps in C# or Visual Basic, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++, see [Asynchronous programming in C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps).
25
+
You can learn how to write asynchronous apps in C#, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++, see [Asynchronous programming in C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps).
Copy file name to clipboardExpand all lines: hub/apps/develop/files/fast-file-properties.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Learn how to quickly gather a list of files and their properties from a library
12
12
13
13
Prerequisites
14
14
-**Asynchronous programming for WinUI apps**
15
-
You can learn how to write asynchronous apps in C# or Visual Basic, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++, see [Asynchronous programming in C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps).
15
+
You can learn how to write asynchronous apps in C#, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++, see [Asynchronous programming in C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps).
16
16
-**Access permissions to Libraries**
17
17
The code in these examples requires the picturesLibrary capability, but your file location may require a different capability, or no capability at all. To learn more, see [File access permissions](./file-access-permissions.md).
Copy file name to clipboardExpand all lines: hub/apps/develop/files/file-properties.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ Get properties—top-level, basic, and extended—for a file represented by a [S
24
24
25
25
-**Understand async programming for WinUI apps**
26
26
27
-
You can learn how to write asynchronous apps in C# or Visual Basic, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++, see [Asynchronous programming in C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps).
27
+
You can learn how to write asynchronous apps in C#, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++, see [Asynchronous programming in C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps).
0 commit comments