mbed library topic

28 Sep 2010

Hello there,

I just got my mbed from digikey this morning and i had a question about the mbed library.  does it contain all of the stdio library functions or just the most common ones?

thanks,

Andrew

28 Sep 2010

Hi Andrew,

You can use most of the ANSI C/C++ functions /headers.

The mbed library itself does not contain this functionality.

It implements hardware abstractions (drivers) on top of this c library.

The c library used in mbed binaries is the version provided by the ARM compiler.

 

Cheers

Rolf

28 Sep 2010

If you had questions like this, are these ARM RealView links the closest things to a compiler reference and user manual (I assume for the online compiler many things have been hidden or changed a bit like the command line options)?

 

 

28 Sep 2010

Hi Andrew,

I think what you are looking for is in:

i.e. we include by default:

 

// Useful C libraries
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

Hope that helps.

Simon

29 Sep 2010 . Edited: 29 Sep 2010

thanks a bunch,

 

i've done a lot of embedded C on PICs but im just trying to get used to the mbed platform.

16 Oct 2010 . Edited: 16 Oct 2010

I have another question regarding the MBed libraries.  I am trying to use the fgets() function in conjunction with reading a text file from an sd card.

when i try to compile with:

fgets(sdRead , 40 , fp);

i get the error  "No instance of function "std::fgets" matches the argument list (E304)" in file "/main.cpp"

 

but i believe that fgets() is a stdio function, similar to gets().

16 Oct 2010 . Edited: 16 Oct 2010

Hi Andrew,

Yep, fgets is a stdio function. The following compiles fine (despite being pointless!):

#include "mbed.h"

int main() {
    FILE *fp = NULL;
    char *p = NULL;
    fgets(p, 1, fp);
}

So I suspect sdRead or fp are not of the right type (e.g. sdRead is perhaps a char, rather than char *)

Simon

16 Oct 2010 . Edited: 16 Oct 2010

wow your fast,

 

I rewrote my program a bit and i am not having the same problem.  There ended up being a problem with my file pointer. (good call)

 

thanks for your help