SW006014 Microchip Technology, SW006014 Datasheet - Page 85

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
© 2008 Microchip Technology Inc.
setbuf
Description:
Include:
Prototype:
Arguments:
Remarks:
Example:
Defines how a stream is buffered.
<stdio.h>
void setbuf(FILE *stream, char *buf);
stream
buf
setbuf must be called after fopen but before any other function calls
that operate on the stream. If buf is a null pointer, setbuf calls the
function setvbuf(stream, 0, _IONBF, BUFSIZ) for no buffering;
otherwise setbuf calls setvbuf(stream, buf, _IOFBF, BUF-
SIZ) for full buffering with a buffer of size BUFSIZ. See setvbuf.
#include <stdio.h> /* for setbuf, printf, */
int main(void)
{
}
Output:
myfile1 has no buffering
myfile2 has full buffering
FILE *myfile1, *myfile2;
char buf[BUFSIZ];
if ((myfile1 = fopen("afile1", "w+")) != NULL)
{
}
if ((myfile2 = fopen("afile2", "w+")) != NULL)
{
}
setbuf(myfile1, NULL);
printf("myfile1 has no buffering\n");
fclose(myfile1);
setbuf(myfile2, buf);
printf("myfile2 has full buffering");
fclose(myfile2);
pointer to the open stream
user allocated buffer
/* fopen, fclose,
/* FILE, NULL, BUFSIZ
DS51456E-page 81
*/
*/

Related parts for SW006014