BBR 1 Ebene

Committer:
borlanic
Date:
Mon May 14 11:29:06 2018 +0000
Revision:
0:fbdae7e6d805
BBR

Who changed what in which revision?

UserRevisionLine numberNew contents of line
borlanic 0:fbdae7e6d805 1 /* mbed Microcontroller Library
borlanic 0:fbdae7e6d805 2 * Copyright (c) 2006-2016 ARM Limited
borlanic 0:fbdae7e6d805 3 *
borlanic 0:fbdae7e6d805 4 * Licensed under the Apache License, Version 2.0 (the "License");
borlanic 0:fbdae7e6d805 5 * you may not use this file except in compliance with the License.
borlanic 0:fbdae7e6d805 6 * You may obtain a copy of the License at
borlanic 0:fbdae7e6d805 7 *
borlanic 0:fbdae7e6d805 8 * http://www.apache.org/licenses/LICENSE-2.0
borlanic 0:fbdae7e6d805 9 *
borlanic 0:fbdae7e6d805 10 * Unless required by applicable law or agreed to in writing, software
borlanic 0:fbdae7e6d805 11 * distributed under the License is distributed on an "AS IS" BASIS,
borlanic 0:fbdae7e6d805 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
borlanic 0:fbdae7e6d805 13 * See the License for the specific language governing permissions and
borlanic 0:fbdae7e6d805 14 * limitations under the License.
borlanic 0:fbdae7e6d805 15 */
borlanic 0:fbdae7e6d805 16 #include "FileHandle.h"
borlanic 0:fbdae7e6d805 17 #include "platform/mbed_retarget.h"
borlanic 0:fbdae7e6d805 18 #include "platform/mbed_critical.h"
borlanic 0:fbdae7e6d805 19
borlanic 0:fbdae7e6d805 20 namespace mbed {
borlanic 0:fbdae7e6d805 21
borlanic 0:fbdae7e6d805 22 off_t FileHandle::size()
borlanic 0:fbdae7e6d805 23 {
borlanic 0:fbdae7e6d805 24 /* remember our current position */
borlanic 0:fbdae7e6d805 25 off_t off = seek(0, SEEK_CUR);
borlanic 0:fbdae7e6d805 26 if (off < 0) {
borlanic 0:fbdae7e6d805 27 return off;
borlanic 0:fbdae7e6d805 28 }
borlanic 0:fbdae7e6d805 29 /* seek to the end to get the file length */
borlanic 0:fbdae7e6d805 30 off_t size = seek(0, SEEK_END);
borlanic 0:fbdae7e6d805 31 /* return to our old position */
borlanic 0:fbdae7e6d805 32 seek(off, SEEK_SET);
borlanic 0:fbdae7e6d805 33 return size;
borlanic 0:fbdae7e6d805 34 }
borlanic 0:fbdae7e6d805 35
borlanic 0:fbdae7e6d805 36 } // namespace mbed