Changeset 647 for trunk/libs/mini-libc
- Timestamp:
- Oct 22, 2019, 1:48:51 PM (6 years ago)
- Location:
- trunk/libs/mini-libc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/mini-libc/stdio.c
r643 r647 412 412 413 413 // compute nbytes 414 unsignedint nbytes = size * nitems;414 int nbytes = size * nitems; 415 415 416 416 if( hal_user_syscall( SYS_READ, … … 435 435 436 436 // compute nbytes 437 unsignedint nbytes = size * nitems;437 int nbytes = size * nitems; 438 438 439 439 if( hal_user_syscall( SYS_WRITE, … … 444 444 445 445 } // end fwrite() 446 447 ////////////////////////////////////////// 448 unsigned int fseek( FILE * stream, 449 unsigned int offset, 450 int whence ) 451 { 452 // check stream valid 453 if( stream->key != VALID_OPEN_FILE ) return -1; 454 455 // get file descriptor from stream pointer 456 int fd = stream->fd; 457 458 return( hal_user_syscall( SYS_LSEEK, 459 (reg_t)fd, 460 (reg_t)offset, 461 (reg_t)whence, 0 ) ); 462 } // end fseek() 446 463 447 464 ///////////////////////////////// -
trunk/libs/mini-libc/stdio.h
r643 r647 146 146 * It can be a regular file or a character oriented input device. 147 147 ********************************************************************************************* 148 * @ buffer : pointer on user buffer. 149 * @ size : item size in bytes. 150 * @ nitems : number of items. 148 151 * @ stream : pointer on a stream. 149 * @ format : formated string.150 152 * @ returns actual number of items read if success / returns 0 if failure. 151 153 ********************************************************************************************/ … … 160 162 * It can be a regular file or a character oriented input device. 161 163 ********************************************************************************************* 164 * @ buffer : pointer on user buffer. 165 * @ size : item size in bytes. 166 * @ nitems : number of items. 162 167 * @ stream : pointer on a stream. 163 * @ format : formated string.164 168 * @ returns actual number of written items if success / returns 0 if failure. 165 169 ********************************************************************************************/ … … 169 173 FILE * stream ); 170 174 175 /********************************************************************************************* 176 * This function moves <nitems> oblects, each <size> bytes long, from an input stream 177 * identified by <stream>, to the user buffer identified by the <buffer> argument. 178 * It can be a regular file or a character oriented input device. 179 ********************************************************************************************* 180 * @ stream : pointer on a stream. 181 * @ offset : used to compute new offset value. 182 * @ whence : operation type (SEEK_SET / SEEK_CUR / SEEK_END) 183 * @ return 0 if success / returns -1 if failure. 184 ********************************************************************************************/ 185 unsigned int fseek( FILE * stream, 186 unsigned int offset, 187 int whence ); 188 189 171 190 #endif // _STDIO_H_
Note: See TracChangeset
for help on using the changeset viewer.