1. Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as:

    All that and more! Registration is quick, simple and absolutely free. Join our community today!

c-languange pa help

Discussion in 'Coding, Programming' started by genji, Jun 7, 2016.

  1. Sa FILE handling pano po ba mag delete ng record /book,
    may alam nako kung pano mag add, search. pero sa delete di pa
    di pa kasi naturo samin,
    ganito po hal. mag e-input po ang user ng book id tapos kung makita e dedelete.

    ano po build-in function nagagamitin madami bang built-in func ang pweding gamitin dyan?

    alam kung maliit ng bagay lang to sa inyo.
    maraming salamat :D
     
  2. Keala Yuriko Kazumori

    Keala Yuriko Kazumori Dyosa ® Staff Member Moderator

    Not sure about this but you can edit this syntax

    1. When You want to delete the record:
    2. void deleteRecord()
    3. {
    4. int enrollNo;
    5. int counter=0;
    6. FILE *ptr2 = fopen("c:\\file2.txt","a");
    7. int records = getNoOfRecords();
    8. refresh();
    9. fflush(stdin);
    10. printf("(text here)\n");
    11. scanf("%d",&enrollNo);
    12. while(counter!=records)
    13. {
    14. fread(&var,sizeof(struct student),1,ptr);
    15. if(var.enrollNo==enrollNo)
    16. {
    17. }
    18. else
    19. {
    20. fwrite(&var,sizeof(struct student),1,ptr2);
    21. }
    22. counter++;
    23. }
    24. fcloseall();
    25. remove("c:\\file.txt");
    26. rename("c:\\file2.txt","c:\\file.txt");
    27. printf("Press any key..");
    28. getch();
    29. }
     
  3. wow 1st step pa lang hindi ko masundan
     
  4. Keala Yuriko Kazumori

    Keala Yuriko Kazumori Dyosa ® Staff Member Moderator

    Medyo lito ako diyan lol c talaga di c++? Or c# lol haha
     
  5. oo c palang languange tinuturo samin hehe
    ahm ito ba yung pa-isa isang delete ng record lang o lahat ng record delete ?
    halimbawa sa student.txt may record ng mga student dun
    I.D NAME LASTNAME
    1234 john doe
    1235 kaela yuriko
    1515 isaac ewan
    ngayon gusto ko e delete si isaac pano?
    anong built-in function gagamitin?
    sa pagkakaintindi ko sa itaas na tinuro mam kaela
    parang lahat ng student.txt ma re remove? tama ba?
     
  6. keala moderator kana pala :D astig. sigurado di mo nako kilala. :(
     
  7. sayang php lang ako magaling:( dahil sayo aaralin ko lahat. motivation
     
  8. haha ganyan nga tol pareho tayo gusto ko rin matutu ng iba't ibang pl