C# Programındaki Hata Nedir?

Kod:
System.IO.DirectoryNotFoundException: Could not find a part of the path "/storage/emulated/0/Android/data/com.radinc.csharpshell/files/CSharpShell/examples/HelloWorld/D:/storage/emulated/0/Download deneme.txt".

Burada "Download" tan sonra slash (/) yok. Bu kısmı bir kontrol edebilirsin.
 
C#:
using System;
using System.IO;

namespace sifreuygulamasi.
{
class Program.
{
static void Main(string[] args)
{
while (true)
{
Console.Write("İşleminizi Girin \n Kayıt için 1 yazin \n giriş için 2 yazin ");
string islem = Console.ReadLine();

 if (islem == "2")
 {
 Console.Write("\nAdinizi Girin: ");
 string isim2 = Console.ReadLine();
 Console.Write("Sifrenizi Girin: ");
 string sifre2 = Console.ReadLine();

 String isim = "";
 String sifre = "1";

 if (isim == isim2 && sifre == sifre2)
 {
 Console.WriteLine("Giriş Başarılı Hoşgeldin {0}", isim);
 }
 else.
 {
 Console.Write("Birisi Yanlış ama hangisi söylemem");
 }
 }

 if (islem == "1")
 {
 FileStream fs = new FileStream("D://storage/emulated/0/Download deneme.txt", FileMode.Append, FileAccess.Write, FileShare.Write);
 StreamWriter sw = new StreamWriter(fs);
 Console.Write("Adınız : ");
 sw.WriteLine(Console.ReadLine());
 sw.Close();
 Console.WriteLine("Kayıt Eklendi.");
 Console.ReadKey();
 }
 }
 }
}
}

D:// kısmını sil.
 
Hala aynı hatayı alıyorum.
C#:
Using System;
Using System. IO;

Namespace sifreuygulamasi.
{
Class program.
{
Static Void main(string[] args)
{ while(true)
{
Console.Write("İşleminizi Girin \n Kayıt için 1 yazin \n giriş için 2 yazin ");
string islem=Console.ReadLine();
if(islem=="2")
{
Console.Write("\nAdinizi Girin: ");
string isim2 = Console.ReadLine();
Console.Write("Sifrenizi Girin: ");
string sifre2 = Console.ReadLine();
String isim = "";
String sifre = "1";
if (isim == isim2 && sifre == sifre2)
{
Console.WriteLine("Giriş Başarılı Hoşgeldin {0}", isim);
}
else.
{
Console.Write("Birisi Yanlış ama hangisi söylemem");
}
}
if(islem=="1");
{

FileStream fs = new FileStream("deneme.txt",FileMode.Append,FileAccess.Write,FileShare.Write);
StreamWriter sw = new StreamWriter(fs);
Console.Write("Adınız : ");
sw.WriteLine(Console.ReadLine());
sw.Close();
Console.WriteLine("Kayıt Eklendi.");
Console.ReadKey();
}
}

}
}
}

Bu şekilde dener misin?
 
Bunu dener misiniz
C#:
using System;
using System.IO;

namespace sifreuygulamasi
{
    class Program
    {
        static void Main(string[] args)
        {
            while(true)
            {
                Console.Write("İşleminizi Girin \n Kayıt için 1 yazin \n giriş için 2 yazin ");
                string islem = Console.ReadLine();
                if (islem == "2")
                {
                    Console.Write("\nAdinizi Girin: ");
                    string isim2 = Console.ReadLine();
                    Console.Write("Sifrenizi Girin: ");
                    string sifre2 = Console.ReadLine();
                    string isim = "John";
                    string sifre = "1";
                    if (isim == isim2 && sifre == sifre2)
                    {
                        Console.WriteLine("Giriş Başarılı Hoşgeldin {0}", isim);
                    }
                    else
                    {
                        Console.Write("Birisi Yanlış ama hangisi söylemem");
                    }
                }
                if (islem == "1")
                {
                    FileStream fs = new FileStream("D://storage/emulated/0/Download deneme.txt",FileMode.Append,FileAccess.Write,FileShare.Write);
                    StreamWriter sw = new StreamWriter(fs);
                    Console.Write(Adınız : ");
                    sw.WriteLine(Console.ReadLine());
                    sw.Close();
                    Console.WriteLine("Kayıt Eklendi.");
                    Console.ReadKey();
                }
            }
                   
        }
    }
}
 
Hata veriyor sanırım mobilden yaptığım için

Hatayı da yollarsanız.
System.IO.DirectoryNotFoundException: Could not find a part of the path "/storage/emulated/0/Android/data/com.radinc.csharpshell/files/CSharpShell/examples/HelloWorld/D:/storage/emulated/0/Download deneme.txt".
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0017d] in <97c6c40360454c158c014ee803ea6785>:0
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <97c6c40360454c158c014ee803ea6785>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
at sifreuygulamasi.Program.Main (System.String[] args) [0x0008c] in <dbddf4952a99443d865af419e7ede7c8>:0
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <97c6c40360454c158c014ee803ea6785>:0

Bunu dener misiniz
C#:
using System;
using System.IO;

namespace sifreuygulamasi
{
    class Program
    {
        static void Main(string[] args)
        {
            while(true)
            {
                Console.Write("İşleminizi Girin \n Kayıt için 1 yazin \n giriş için 2 yazin ");
                string islem = Console.ReadLine();
                if (islem == "2")
                {
                    Console.Write("\nAdinizi Girin: ");
                    string isim2 = Console.ReadLine();
                    Console.Write("Sifrenizi Girin: ");
                    string sifre2 = Console.ReadLine();
                    string isim = "John";
                    string sifre = "1";
                    if (isim == isim2 && sifre == sifre2)
                    {
                        Console.WriteLine("Giriş Başarılı Hoşgeldin {0}", isim);
                    }
                    else
                    {
                        Console.Write("Birisi Yanlış ama hangisi söylemem");
                    }
                }
                if (islem == "1")
                {
                    FileStream fs = new FileStream("D://storage/emulated/0/Download deneme.txt",FileMode.Append,FileAccess.Write,FileShare.Write);
                    StreamWriter sw = new StreamWriter(fs);
                    Console.Write(Adınız : ");
                    sw.WriteLine(Console.ReadLine());
                    sw.Close();
                    Console.WriteLine("Kayıt Eklendi.");
                    Console.ReadKey();
                }
            }
                  
        }
    }
}
Hala aynı hatayı almaktayım
 
Son düzenleme:

Technopat Haberler

Yeni konular

Geri
Yukarı