File.Create Question

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2005
Posts: 1,542
Reputation: tayspen is on a distinguished road 
Solved Threads: 98
Team Colleague
tayspen's Avatar
tayspen tayspen is offline Offline
<Insert title here>

File.Create Question

 
0
  #1
Sep 4th, 2005
Ok so i want to create a file

  1.  
  2. File.Create("..."):

I want it to be able to detect the user that is on so it automatically creates it on there desktop. Is this possible.
Firefox
Ewido
Tune up windows
Get detailed system information
My Fixes

Member - Alliance of Security Analysis Professionals - Since 2006
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 55
Reputation: r0ckbaer is an unknown quantity at this point 
Solved Threads: 6
r0ckbaer r0ckbaer is offline Offline
Junior Poster in Training

Re: File.Create Question

 
0
  #2
Sep 5th, 2005
  1. // Creates a file called "test.txt" on the currently logged-in
  2. // user's desktop
  3. File.Create(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\testfile.txt");
  4.  
  5. // Or if you only want to find out the user that is currently logged in
  6. String userName = Environment.GetEnvironmentVariable("username");
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 1,542
Reputation: tayspen is on a distinguished road 
Solved Threads: 98
Team Colleague
tayspen's Avatar
tayspen tayspen is offline Offline
<Insert title here>

Re: File.Create Question

 
0
  #3
Sep 5th, 2005
Originally Posted by r0ckbaer
  1. // Creates a file called "test.txt" on the currently logged-in
  2. // user's desktop
  3. File.Create(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\testfile.txt");
  4.  
  5. // Or if you only want to find out the user that is currently logged in
  6. String userName = Environment.GetEnvironmentVariable("username");


Ok, Thank that was easy enough.


Thanks


-T
Firefox
Ewido
Tune up windows
Get detailed system information
My Fixes

Member - Alliance of Security Analysis Professionals - Since 2006
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC