Link to home
Start Free TrialLog in
Avatar of jpcs
jpcs

asked on

Struct

Hi!

Please help me with this :

I need to use a binary file with this structure :

Name : string : 30 chars
Age : Integer


How to add to the file one record
How to remove ... p.e. The second (after 4 inserted)
and how to change ... p.e The first.


thanks
Avatar of AlexVirochovsky
AlexVirochovsky

Wer don't make you homework instead of you! Send you code and wer can help,descuss, fix errors, but you homework you must make youself.
Avatar of jpcs

ASKER

sorry, but no homework...

I can even start, because I tried to use the samples I have in my book "CGI programming in the WWW", but they use pointers, and I don't understand that much.

I can simply give you some suggestions but no code. fread() is a function which
reads a specified number of equal-sized data items from an input stream into a block. It works on binary files.
Use fseek to set the position in the file. the position is (n-1)*sizeof(struct)
If you have problems with pointers, i can send you tutorial about this(write you EMail).
Avatar of jpcs

ASKER

Thanks but, I need an example.

Alex : jsantos98@usa.net
Ok, done.
Avatar of jpcs

ASKER

Hi everyone!

I've finally solved my problem thanks to the tuturial ginven from Alex. I'll give him the points.

Thanks Alex
ASKER CERTIFIED SOLUTION
Avatar of AlexVirochovsky
AlexVirochovsky

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial