hello frnds recently i was wrighting a prog using c i was trying to delete record from the an existing file...... my record was of structure type ......but i was unable to do it.............:nonod: can any body give me the logic to delete this kind of record from a file??????
You can't; there is no way to close up the gap freed by a deleted record, other than to copy all the records into a new file except the one you want to delete.
ok bro, thanx 4 the info....... can u give me a small code of it...... suppose i m using a structure as struct emp { int emp_code; int d_code; char emp_loc[25]; char emp_name[30]; }; now can u wright a code 4 me to wright a 4 to five record in file say "emp" then delete one of a record from it??? :worried:
No, I'm not going to write code for you for free, although if you're prepared to pay the going rate I might consider it. It's not difficult, where exactly are you stuck and how far did you get?
actually i have written the prog.....according to ur logic........it is woriking for the first time only.......that is after adding & then printing the records when i m deleting it after that all the data gives garbage values:nonod: .......wat i vl do
Guys you dont need to charge people for money to write a couple lines of code, its not like those couple lines of code will earn that person a shiz load of money. What you're doing is just basically helping them out and teaching them at the same time.
rakesh48019: OK, post what you've got so far, stripped down to show just the problem you're having, then we can see where you're going wrong and advise on where, why and possible solutions. sofprog66: many people post to forums trying to get people to write their code for them, because they're on a course and want to get through it with the minimal legwork, which is fine but they don't learn anything in the process, plus credit shouldn't go to them but to the person who actually wrote the code. On the other hand if they post what they've got then we can see where they're struggling, for example if they say "I'm allocating an array", you wouldn't necessarily see the problem, but if they show you the code "char *str1=malloc(20); char str2[] = { sizeof(str1) };" (I saw something similar to that just yesterday) you can see they've pretty much not got a clue about the syntax. Anyway if you think rakesh48019 will learn something by you writing the code for him (and maybe he will) then by all means go ahead and write it for him. rakesh48019: sorry if you're offended by any of the above. People can be very devious and say all sorts of stuff to try to get people to write code for them. So please don't take offence, just post your code and we'll help you solve the problem(s) with it.
xpi0t0s I meant no offence, I understand he needs to write some code in order to get some help. That should actually become a rule in this forum.