Arkadaşlar aşağıdaki programı calıştırdıktan sonra ana menuden 1 girerek bir adet kayıt alıyorum kullanıcıdan. Atıyorum ad q soyad q numara 123123 olarak girilsin.

Daha sonra delete fonksiyonunu kullanarak (ana menuden 5 girerek) bu girdiğim kaydı silmek icin oraya tekrar atama yapmak istiyorum. (Ad, soyad ve numara 0 degerine ya da NULL değerine eşit olsun diye uğraşıyorum) Ancak ne denediysem atamayı delete fonksiyonu icersinde bir turlu yapamadım. Kod satırlarında ((( deletE() fonksiyonunda ))) yaptığım atamalara (// olarak yorum satırlarında) bakabilirsiniz.

Acaba nasıl atama yapılmalı ?

Kod:
#include // "stdlib" library contains of exit() function #include // "malloc" library contains of malloc() function #include // "Windows" library contains of Sleep() function which waits the system as you want #include // "io" library contains of filelength() function #include // "string" library contains of strlen() function #include // "stdio" library contains of other functions which hasn't been mentioned typedef struct personKnowledge // Structe and it's elements are being defined ; FILE *ptrFILE, *ptrFILE1; // Variables are being defined long int recordLength, totalRecordLength, location; int choice, number, totalRecordNumber, i; static int counter = 0; int menu(); // Functions are being defined void newRecord(); void display(); void update(); void add(); void deletE(); int main() // Program is being initialiezed int menu() // Options are being presented to user case 2: case 3: case 4: case 5: case 6: default: } } while (choice >= 1 && choice 0) // If there is knowledge in that location and numbeer is greater than 0 else free(s); fclose(ptrFILE); } void deletE() system("cls"); Sleep(350); personKnowledge *del; // del = (Deleting) del = (personKnowledge *)malloc(sizeof(personKnowledge)); fflush(stdin); recordLength = sizeof(*del); totalRecordLength = filelength(fileno(ptrFILE)); totalRecordNumber = totalRecordLength / recordLength; printf("nExpress person number which you want to delete: "); scanf("%d", &number); fflush(stdin); fseek(ptrFILE, (number-1)*recordLength, SEEK_SET); if (fread(&(*del), recordLength, 1, ptrFILE) != 0 && number > 0) // If there is knowledge in that location and number is greater than 0 ;