Пн апр 21, 2014 14:35:19
Пн апр 21, 2014 16:23:15
Пн апр 21, 2014 18:07:35
Вт апр 22, 2014 19:58:02
Вт апр 22, 2014 21:56:35
Вт апр 22, 2014 22:40:24
Вт апр 22, 2014 22:41:03
Ср апр 23, 2014 00:41:38
Ср апр 23, 2014 15:58:49
Ср апр 23, 2014 17:47:50
/** This macro inserts a pointer to user defined data into a FILE
stream object.
The user data can be useful for tracking state in the put and get
functions supplied to the fdevopen() function. */
#define fdev_set_udata(stream, u) do { (stream)->udata = u; } while(0)
/** This macro retrieves a pointer to user defined data from a FILE
stream object. */
#define fdev_get_udata(stream) ((stream)->udata)
/**
Stream that will be used as an input stream by the simplified
functions that don't take a \c stream argument.
The first stream opened with read intent using \c fdevopen()
will be assigned to \c stdin.
*/
#define stdin (__iob[0])
/**
Stream that will be used as an output stream by the simplified
functions that don't take a \c stream argument.
The first stream opened with write intent using \c fdevopen()
will be assigned to both, \c stdin, and \c stderr.
*/
#define stdout (__iob[1])
/**
Stream destined for error output. Unless specifically assigned,
identical to \c stdout.
If \c stderr should point to another stream, the result of
another \c fdevopen() must be explicitly assigned to it without
closing the previous \c stderr (since this would also close
\c stdout).
*/
#define stderr (__iob[2])
/*
* This is an internal structure of the library that is subject to be
* changed without warnings at any time. Please do *never* reference
* elements of it beyond by using the official interfaces provided.
*/
struct __file {
char *buf; /* buffer pointer */
unsigned char unget; /* ungetc() buffer */
uint8_t flags; /* flags, see below */
#define __SRD 0x0001 /* OK to read */
#define __SWR 0x0002 /* OK to write */
#define __SSTR 0x0004 /* this is an sprintf/snprintf string */
#define __SPGM 0x0008 /* fmt string is in progmem */
#define __SERR 0x0010 /* found error */
#define __SEOF 0x0020 /* found EOF */
#define __SUNGET 0x040 /* ungetc() happened */
#define __SMALLOC 0x80 /* handle is malloc()ed */
#if 0
/* possible future extensions, will require uint16_t flags */
#define __SRW 0x0100 /* open for reading & writing */
#define __SLBF 0x0200 /* line buffered */
#define __SNBF 0x0400 /* unbuffered */
#define __SMBF 0x0800 /* buf is from malloc */
#endif
int size; /* size of buffer */
int len; /* characters read or written so far */
int (*put)(char, struct __file *); /* function to write one char to device */
int (*get)(struct __file *); /* function to read one char from device */
void *udata; /* User defined and accessible data. */
};
int (*put)(char, struct __file *); /* function to write one char to device */
Ср апр 23, 2014 17:54:59
YS писал(а):Даже не могу сходу придумать, зачем такое могло бы понадобиться. Так что с этим похоже и правда мало кто сталкивался.
предполагать не надо, можно быть увереннымuni писал(а):Чисто логически можно предположить следующее
Ср апр 23, 2014 22:38:12
Функция printf() неявно использует переменную stdout для своей работы, т.е. она делает то же, что и fprintf( stdout, ... ). Такое поведение определяется стандартом языка C. Есть три зарезервированных переменных типа указатель на FILE.
Ср апр 23, 2014 23:08:25
Чт апр 24, 2014 00:04:36
int (*put)(char, struct __file *); /* function to write one char to device */
Чт апр 24, 2014 10:06:11
кое-кто сталкивался
во всяком случае если вы уж решились использовать форматированный вывод, отжирающий минимум 1,5-2К памяти программ
Чт апр 24, 2014 17:03:35
Чт апр 24, 2014 20:13:03
mideni писал(а):Я просто хочу понять зачем в void lcd_driver(char c, FILE * stream); надо писать именно в этой функ. второй параметр FILE *stream
Вт авг 31, 2021 11:30:38
char *buf; /* buffer pointer */
unsigned char unget; /* ungetc() buffer */
и
int size; /* size of buffer */
int len; /* characters read or written so far */
int (*put)(char, struct __file *); /* function to write one char to device */
int (*get)(struct __file *); /* function to read one char from device */
Вт авг 31, 2021 14:44:06
Вт авг 31, 2021 15:24:37