X-Git-Url: http://git.maemo.org/git/?p=mardrone;a=blobdiff_plain;f=mardrone%2FARDrone_SDK_Version_1_8_20110726%2FExamples%2FiPhone%2FFreeFlight%2FClasses%2Fplf.c;fp=mardrone%2FARDrone_SDK_Version_1_8_20110726%2FExamples%2FiPhone%2FFreeFlight%2FClasses%2Fplf.c;h=7774b32c93b20748eb00ddddf2d48f48509a8ad7;hp=0000000000000000000000000000000000000000;hb=9ec9bc13b75d30bc45535c54a652934debfcea92;hpb=ae0a3c2dc0898400aca0dd6b439c5db8044db7b2 diff --git a/mardrone/ARDrone_SDK_Version_1_8_20110726/Examples/iPhone/FreeFlight/Classes/plf.c b/mardrone/ARDrone_SDK_Version_1_8_20110726/Examples/iPhone/FreeFlight/Classes/plf.c new file mode 100644 index 0000000..7774b32 --- /dev/null +++ b/mardrone/ARDrone_SDK_Version_1_8_20110726/Examples/iPhone/FreeFlight/Classes/plf.c @@ -0,0 +1,34 @@ +/* + * plf.c + * ARUpdater + * + * Created by f.dhaeyer on 06/07/10. + * Copyright 2010 Parrot SA. All rights reserved. + * + */ +#include +#include +#include "plf.h" + +/** Get version numbers of plf + * @return -1 if error of file, else 0 + */ +int +plf_get_header(const char *plf_filename, plf_phdr *header) +{ + plf_phdr h; + int result = -1; + FILE *f = fopen(plf_filename, "rb"); + if(f != NULL) + { + printf("File %s opened\n", plf_filename); + if(fread(&h, 1, sizeof(plf_phdr), f) == sizeof(plf_phdr)) + { + memcpy(header, &h, sizeof(plf_phdr)); + result = 0; + } + fclose(f); + } + + return result; +}