Вы можете создать запись A с именем @
, значение которой равно IP-адресу вашего сайта. Вы не можете иметь CNAME для @
(корневой домен). Ну, вы можете, но это против правил (afaik).
var buffer = new char[32768] ;
using (var stream = new StreamReader (pathToFile,
new UTF8Encoding (true, true)))
{
while (true)
try
{
if (stream.Read (buffer, 0, buffer.Length) == 0)
return GoodUTF8File ;
}
catch (ArgumentException)
{
return BadUTF8File ;
}
}
@George2 I think they mean a solution like the following (which I haven't tested).
Handling the transition between buffers (i.e. caching extra bytes/partial chars between reads) is the responsibillity and an internal implementation detail of the StreamReader implementation.
using System;
using System.IO;
using System.Text;
class Test
{
public static void Main()
{
try
{
// Create an instance of StreamReader to read from a file.
// The using statement also closes the StreamReader.
using (StreamReader sr = new StreamReader(
"TestFile.txt",
Encoding.UTF8
))
{
const int bufferSize = 1000; //could be anything
char[] buffer = new char[bufferSize];
// Read from the file until the end of the file is reached.
while (bufferSize == sr.Read(buffer, bufferSize, 0))
{
//successfuly decoded another buffer's-worth of data
}
}
}
catch (Exception e)
{
// Let the user know what went wrong.
Console.WriteLine("The file could not be read:");
Console.WriteLine(e.Message);
}
}
}