@dovid
2 הקודים שכתבת מחזירים לי שגיאה כזו
עריכה: עכשיו אני שם לב שהקובץ היה פתוח ולכן הוא החזיר שגיאה על כן הקוד הראשון שכתבת עובד
אבל זה לא פותר לי את הבעיה שכתבתי לקמן ..
Unhandled exception. System.IO.IOException: The process cannot access the file 'C:\Users\User\Desktop\Barbar\Privimail\log.csv' because it is being used by another process.
at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at tast1.Program.Main(String[] args)
אמנם כאשר אני כותב כך
FileStream fs = new FileStream(Directory.GetCurrentDirectory() + @"\Privimail\log.csv",
FileMode.Append,
FileAccess.Write);
StreamWriter writer1 = new StreamWriter(fs);
writer1.Write(DateTime.Now);
writer1.WriteLine("00:00:50");
writer1.Close();
fs.Close();
הוא עובד אבל מכניס לי את 2 הפרמטרים לתא אחד 14/05/2021 15:17:0900:00:50
ואני ביקשתי..
@אוריי אמר בעזרה | כתיבת נתונים בקובץ CSV ע"י #C:
כלומר שהDateTime.Now
יכנס לעמודה A והSeconds
יכנס לעמודה B
ואני יפשוט את שאלתי: איך אני מכניס את הערך שבשורה 6 לעמודה B בקובץ CSV?