Forum » Programiranje » [C#] Dodajanje stringov v .txt file
[C#] Dodajanje stringov v .txt file
![](https://static.slo-tech.com/stili/avatar_gray.gif)
maticm ::
hočem shranjevati v txt file in delam takole!
using (StreamWriter sw = new StreamWriter("k:\\TestFile.txt"))
{
// Add some text to the file.
sw.WriteLine(temp);
// Arbitrary objects can also be written to the file.
sw.WriteLine(DateTime.Now);
}
Problem je v tem, da mi vedno prepisuje zadnjo temperaturo temp...jaz pa želim, da se dodaja v ta isti txt file.
program se cikla tako da vedno kličem isti del za shranjevanje v txt datoteko (napisan zgoraj).
using (StreamWriter sw = new StreamWriter("k:\\TestFile.txt"))
{
// Add some text to the file.
sw.WriteLine(temp);
// Arbitrary objects can also be written to the file.
sw.WriteLine(DateTime.Now);
}
Problem je v tem, da mi vedno prepisuje zadnjo temperaturo temp...jaz pa želim, da se dodaja v ta isti txt file.
program se cikla tako da vedno kličem isti del za shranjevanje v txt datoteko (napisan zgoraj).
- spremenilo: snow ()
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | [c#] iz class v classOddelek: Programiranje | 902 (776) | darkolord |
» | [c#] shrani text, tabele, slikeOddelek: Programiranje | 1544 (1150) | klemen93 |
» | [C#] Podatki objekta v .txt fileOddelek: Programiranje | 799 (723) | Cvenemir |
» | [C#] Zapis texta v nek fileOddelek: Programiranje | 1034 (932) | gnomee |
» | C# iz form2 v form1,textboxiOddelek: Programiranje | 1964 (1590) | Keki |