Yes, you should be able to as nesc is just a preprocessor for C. I just tried it out. I did the following as an experiment.

At the top MultiHopEngineM.nc, I added

#include <stdlib.h>

in initialize(), I added did the following

  static void initialize() {
    int n;

        unsigned int x;    <---- Added

    for (n=0; n < FWD_QUEUE_SIZE; n++) {
      FwdBufList[n] = &FwdBuffers[n];
    }
        
        x=atoi("123");     <---- Added

    iFwdBufHead = iFwdBufTail = 0;
  }

I did a build for one of the tutorial that uses MultiHop, and no errors were reported for stdlib.h or atoi().

cheers,

Tehn Yit Chin
Embedded System Engineer, Grey Innovation Pty. Ltd.


saadia khan wrote:
Can anyone tell me whether the C functions can be used  in nesc code, e.g.,  
using basic math functions like sqrt() or pow() or other maths functions?

Thankyou
S Khan




------------------------------------------------------------------------

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to