Code for Reading and writing from a file in c#?
Answer / sabina
StreamWriter and StreamReader can be used to read and write
unicode chars to a file.
TextWriter adn TextReader are abstract base class from
which SW and SR inherits.
Stream is an abstract base class supports reading and
writing bytes into a file(arrays -> file) (file -> arrays)
FileStream exposes the stream ard the file
BinaryStream is used to write and read primitive
datatypes/encoded strings to files.
to encode string to bytes
byte[] b = new UTF8Encoding(true).GetBytes(string);
to decode string from bytes
String str = new UTF8Encodeing(true).GetString(b);
Is This Answer Correct ? | 0 Yes | 0 No |
c# code to Count number of 1's in a given range of integer (0 to n)
program to reverse the order of digits in a given number of any length.
how to change password in .net with c # with ado.net and also SQL server 2008 change password
Coding for using Nullable Types in C#?
program to reverse the order of words in a string.
Write a program to count 3Letter, 4Letter and 5Letter words from a file and print the number of 3Letter, 4Letter and 5Letter words. Delimiter is space, tab, hifen. Also we should not consider the line in the file after we encounter # in that line.
Can you declare an array of mixed Types?
Hello I am hosting remoting within IIS. Everything works just fine as long as I allow anonymous access at the IIS level. When I allow only Windows Authenticated sessions, something very strange happens: If the client activates the remote object with IP address - works fine If the client activates it using a machine name - get http 401 exception is thrown. The exception is thrown when the client calls the remote method. I set the channel's useDefaultCredentials property to true. Any idea how to allow Windows Authentication? Here is the call stack: System.Net.WebException: The remote server returned an error: (401) Unauthorized .. ---> System.ComponentModel.Win32Exception: The target principal name is incorrect at System.Net.NTAuthentication.GetOutgoingBlob(Byte[] incomingBlob, Boolean handshakeComplete) at System.Net.NTAuthentication.GetOutgoingBlob(String incomingBlob, Boolean handshakeComplete) at System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate) at System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate) at System.Net.NegotiateClient.Authenticate(String challenge, WebRequest webRequest, ICredentials credentials) at System.Net.AuthenticationManager.Authenticate(String challenge, WebRequest request, ICredentials credentials) at System.Net.AuthenticationState.AttemptAuthenticate (HttpWebRequest httpWebRequest, ICredentials authInfo) --- End of inner exception stack trace ---
How to add a value from textBox over an existing certain column in SQL Server
I am developing a web application using google map api.I want to update the map inside the div control within update panel. I got other controls updated but map doesn't get updated.I do not not want to update map whenever unnecessary controls are fired at server side.How could it be achieved?
Write a function which accepts list of nouns as input parameter and return the same list in the plural form. Conditions: i) if last letter is r then append s ii) if word ends with y then replace it by ies iii) call this function in main() and produce the required output. for eg:- if chair is input it should give chairs as output.
program for string reverse(eg:- i am boy -> boy am i)
8 Answers Black Pepper, Infosys, Mind Tree,