Answered by:
create txt file in c:\

Question
-
hi everybody !!
I want to know how can I create a txt file in c:
( c:\myTxtFile.txt )
here I don't have this option ! =/
thx all ! ^^
Saturday, April 21, 2012 6:08 PM
Answers
-
Here is an example of how to read a text file that is inside your project:
//Read a text file in the 'data' folder in the app package. //Outputs the contents to the console function getDataFromPackage(fileName) { var myPackage = Windows.ApplicationModel.Package.current; var instLocation = myPackage.installedLocation; var path = "data\\" + fileName; instLocation.getFileAsync(path) .then(function (file) { return Windows.Storage.FileIO.readTextAsync(file); }).done(function (myText) { console.log(myText); }); }
Monday, April 23, 2012 10:30 PM
All replies
-
Hi,
You can create file in ApplicationData.LocalFolder or KnownFolders.
You cannot directly create file in other random folders because of security considerations.
Best wishes,
Robin [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Proposed as answer by jrboddie Tuesday, April 24, 2012 1:09 PM
Monday, April 23, 2012 3:42 AMModerator -
humm ... and if I want to access a txt file inside my project ! like this:
Monday, April 23, 2012 7:08 PM -
Here is an example of how to read a text file that is inside your project:
//Read a text file in the 'data' folder in the app package. //Outputs the contents to the console function getDataFromPackage(fileName) { var myPackage = Windows.ApplicationModel.Package.current; var instLocation = myPackage.installedLocation; var path = "data\\" + fileName; instLocation.getFileAsync(path) .then(function (file) { return Windows.Storage.FileIO.readTextAsync(file); }).done(function (myText) { console.log(myText); }); }
Monday, April 23, 2012 10:30 PM