Hi!

> > But all other functions of libopensc require the caller to allocate
> > enough space.
> Vital for maintainable software: who needs memory, allocates (*and
> frees*) it. As a sage said a long time ago: "or you rewrite your project
> this way, or your project will rewrite you" :)

As long as behavior is documented and understood, I do not see a
problem.

BTW, you can use object oriented style in C code: Implement something
like sc_apdu_new, sc_apdu_free and maybe some getter and setter
functions. This makes memory management a little easier.

> > In the third solution the caller still allocates memory. He then
> > sequentially calls sc_read_binary with more and more space allocated. He
> > stops when the first error is thrown.
> What about allocating 'x' (32?) KB then reads the whole file?

This is what I am talking about and this is what doesn't working, atm.

> > The problem I have is to read a file with an unknown length.
> How is that possible? Aren't file sizes fixed at file creation time?
> Have I missed something?
> IIUC, when you issue a SELECT_FILE, you can see its size, too. I'm confused.

Some cards return empty or no file control information.

Cheers, Frank.

Attachment: pgp2ynziFMMuU.pgp
Description: PGP signature

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to