עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

בעיה בכתיבה לקובץ

Featured Replies

פורסם

למה בכל פעם שאני נכנס ללולאה , הfwrite כותבת לי מעל הקיים במקום בהמשך הקובץ? (גם כשאני שם fseek )

(הקובץ נפתח עם הרשאה ab+)

while(PP)     
{
//fseek(fpp,0,SEEK_END);
fflush(stdin);
if(fwrite(PP,sizeof(struct pcourse),1,fpp)!=1)
{
perror("Can not write to file fp1!");
exit(4);
}
PP=PAdvance(PP);
}

פורסם

בתור התחלה, אתה צריך "+wb" ולא "ab+".

חוץ מזה, אחרי שפתחת את הקובץ דלג לקצה עם fseek. תעשה אתה זה פעם אחת ולא כל פעם מחדש בתוך הלולאה.

פורסם
  • מחבר

wb+ עם fseek אל סוף הקובץ

הוא שקול לab+ שפותח אותו אוטומטית אל סוף הקובץ (אמור לפתוח)

במקרה שלי הftell אחרי פתיחת הקובץ עם ab+ מחזירה לי אפס משום מה

השאלה אם זה אמור להיות ככה כי הרי a אמור לכתוב בהמשך הקובץ ללא דריסה.

פורסם

מה-man page של fopen:

a+

Open for reading and appending (writing at end of file). The file is created if it does not exist. The initial file position for reading is at the beginning of the file, but output is always appended to the end of the file.

כלומר זה רק עניין של קריאת הקובץ. אתה גם יכול לפתוח את הקובץ עם "ab".

פורסם
  • מחבר

סבבה תודה

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.