473,378 Members | 1,422 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Problem with System.IO.File

hello
i am trying to create a new file and then to write to it. how can i
create an new file? i tried System . IO.File but it returns an error
as follows:
System.IO.File.File() is inaccessible due to its protection level
Nov 17 '05 #1
1 3570
There are a bit many ways to create a file. Here's one

FileStream fileStream = System.IO.File.Create("example.txt");
fileStream.Write(0xFF);

the FileStream's write methods though really only allow you to write byte
and arrays of bytes to the stream, if you wanna write strings you can use a
StreamWriter along with the file stream;

StreamWriter writer = new StreamWriter(fileStream);
writer.Write("Hello ");
writer.WriteLine("World !");

HTH
Cordell Lawrence
Teleios Systems Ltd.

"liran" <li**********@gmail.com> wrote in message
news:44**************************@posting.google.c om...
hello
i am trying to create a new file and then to write to it. how can i
create an new file? i tried System . IO.File but it returns an error
as follows:
System.IO.File.File() is inaccessible due to its protection level

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: HakonB | last post by:
Hi all I get an exception when trying to deserialize a simple configuration file using XML Serialization. The very long stacktrace can be seen at the bottom of this message. I've see other...
3
by: Jagdip Singh | last post by:
Hi, We are facing problem accessing to DB2. Seems like database manager is down I tried starting it using db2start but it was neither showing any messages nor returning to command prompt...
1
by: Günther Rühmann | last post by:
Hi, I´m not sure if i´m right int this group... My problem: I made a vb .net application that reads from AD via System.Directoryservices.Directoryentry. The appliocation enumerates group...
4
by: moondaddy | last post by:
Using vb.net I need to download image files to the client browser where they can save to disk. Below is some sample code I'm using. when I run this the File Download window in the browser says: ...
4
by: Antonio Carpentieri | last post by:
Hi all, in my previous post I've wrong typed some tems.. this is the corrected post. in a aspx page I have a repeater like this: <asp:repeater id=repeaterResults runat="server"...
9
by: Günther Rühmann | last post by:
Hi, I´m not sure if i´m right int this group... My problem: I made a vb .net application that reads from AD via System.Directoryservices.Directoryentry. The appliocation enumerates group...
8
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my...
2
by: Jeff | last post by:
Hey asp.net 2.0 My asp.net 2.0 project has got a assembly load problem: Some of my web.config settings: <membership defaultProvider="AH_MembershipProvider" userIsOnlineTimeWindow="15">
0
by: Budhi Saputra Prasetya | last post by:
Hi, I still have the same problem with embedding Windows Control. I'll just requote what I posted last time: I managed to create a Windows Form Control and put it on my ASP .NET page. I...
0
by: Filemaxor | last post by:
I have gotten my code to be able to allow people to add new text to a .txt document and able to call up files so the user can see whats in it. The problem i'm having is getting the for loop to work...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.