SW006014 Microchip Technology, SW006014 Datasheet - Page 198

C COMPILER MPLAB FOR PIC24 MCU

SW006014

Manufacturer Part Number
SW006014
Description
C COMPILER MPLAB FOR PIC24 MCU
Manufacturer
Microchip Technology
Type
MPLAB® C Compilerr
Series
PIC24r
Datasheet

Specifications of SW006014

Supported Families
PIC24
Core Architecture
PIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24
Tool Function
Compiler
Tool Type
Compiler
Processor Series
PIC24
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC24
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
DS51456E-page 194
read
Description:
Include:
Prototype:
Argument:
Return Value:
Remarks:
Default Behavior:
File:
sbrk
Description:
Include:
Prototype:
Argument:
Return Value:
Remarks:
Default Behavior:
File:
Read data from a file.
None
int read(int handle, void *buffer,
handle
buffer
len
Returns the number of characters read, which may be less than len if
there are fewer than len characters left in the file or if the file was
opened in text mode, in which case each carriage return-linefeed
(CR-LF) pair is replaced with a single linefeed character. Only the sin-
gle linefeed character is counted in the return value. The replacement
does not affect the file pointer. If the function tries to read at end-of-file,
it returns ‘0’. If the handle is invalid, or the file is not open for reading, or
the file is locked, the function returns ‘-1’.
This helper function is called by the Standard C Library functions
fgetc(), fgets(), fread(), and gets().
As distributed, the parameters are passed to the host file system
through the simulator. The return value is the value returned by the host
file system.
read.c
Extend the process' data space by a given increment.
None
void * sbrk(int incr);
incr
Return the start of the new space allocated, or ‘-1’ for errors.
sbrk() adds incr characters to the break value and changes the
allocated space accordingly. incr can be negative, in which case the
amount of allocated space is decreased.
sbrk() is used to dynamically change the amount of space allocated
for the calling process's data segment. The change is made by reset-
ting the process's break value and allocating the appropriate amount of
space. The break value is the address of the first location beyond the
end of the data segment. The amount of allocated space increases as
the break value increases.
This is a helper function called by the Standard C Library function
malloc().
If the global variable __curbrk is zero, the function calls brk() to ini-
tialize the break value. If brk() returns -1, so does this function.
If the incr is zero, the current value of the global variable __curbrk
is returned.
If the incr is non-zero, the function checks that the address
(__curbrk + incr) is less than the end address of the heap. If it is
less, the global variable __curbrk is updated to that value, and the
function returns the unsigned value of __curbrk.
Otherwise, the function returns -1.
See the description of brk().
sbrk.c
unsigned int len);
handle referring to an opened file
points to the storage location for read data
the maximum number of characters to read
number of characters to increment/decrement
© 2008 Microchip Technology Inc.

Related parts for SW006014