小编Lor*_*rri的帖子

FileStream.WriteLine()不写入文件

我正在尝试制作一个将数据存储在TXT日志文件中的简单软件.这是我的代码

FileStream fs = null;
StreamWriter fw = null;
try
{
    fs= new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.Desktop)+"/textme.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
    fw = new StreamWriter(fs);
    fw.Write("sadadasdsadsadsadas");

    for (int i = 0; i < AnimalShelter.AnimalList.Count; i++)
    {
        fw.WriteLine("<chipNr>" + AnimalShelter.AnimalList[i].ChipRegistrationNumber + "<chipNr>");
        Console.WriteLine("<chipNr>" + AnimalShelter.AnimalList[i].ChipRegistrationNumber + "<chipNr>");
    }
}
catch(IOException)
{
    MessageBox.Show("ERROR THROWN");
}
finally
{
    if (fs!= null) fs.Close();
    //  if (fw != null) fw.Close();
}
Run Code Online (Sandbox Code Playgroud)

我实现的是:文件被创建,但没有任何内容写入其中.我查了很多帖子但是找不到任何特别的帮助.

c# file-io stream text-files

6
推荐指数
2
解决办法
3万
查看次数

如何在Nginx配置文件中配置Phalcon

我正在尝试设置NGINx服务器以使用Phalcon PHP Framework.到目前为止,我一直在寻找互联网上的帮助,但我找不到任何东西......

我的conf文件是:

server {
#listen   80; ## listen for ipv4; this line is default and implied
#listen   [::]:80 default ipv6only=on; ## listen for ipv6

root /usr/share/nginx/www;
index index.php index.html index.htm;

# Make site accessible from http://localhost/
server_name localhost;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to index.html
    try_files $uri $uri/ /index.html;
    # Uncomment to enable naxsi on this location
    # include /etc/nginx/naxsi.rules
}

location /doc/ {
    alias …
Run Code Online (Sandbox Code Playgroud)

php configuration nginx phalcon

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×1

configuration ×1

file-io ×1

nginx ×1

phalcon ×1

php ×1

stream ×1

text-files ×1