C# Program to display temporary file names



The GetTempPath() method in C# displays temporary file names −

Path.GetTempPath();

Get the names in a variable and display −

string tempFile = Path.GetTempPath();

The following is the code −

Example

 Live Demo

using System; using System.IO; class Demo {    static void Main() {       string tempFile = Path.GetTempPath();       Console.WriteLine(tempFile);    } }

Output

/tmp/
Updated on: 2020-06-22T14:55:40+05:30

242 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements