Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mbed-os/platform/FileHandle.cpp@0:fb8047b156bb, 2020-01-15 (annotated)
- Committer:
- rahul_dahiya
- Date:
- Wed Jan 15 15:57:15 2020 +0530
- Revision:
- 0:fb8047b156bb
STM32F7 LWIP
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| rahul_dahiya |
0:fb8047b156bb | 1 | /* mbed Microcontroller Library |
| rahul_dahiya |
0:fb8047b156bb | 2 | * Copyright (c) 2006-2016 ARM Limited |
| rahul_dahiya |
0:fb8047b156bb | 3 | * |
| rahul_dahiya |
0:fb8047b156bb | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| rahul_dahiya |
0:fb8047b156bb | 5 | * you may not use this file except in compliance with the License. |
| rahul_dahiya |
0:fb8047b156bb | 6 | * You may obtain a copy of the License at |
| rahul_dahiya |
0:fb8047b156bb | 7 | * |
| rahul_dahiya |
0:fb8047b156bb | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| rahul_dahiya |
0:fb8047b156bb | 9 | * |
| rahul_dahiya |
0:fb8047b156bb | 10 | * Unless required by applicable law or agreed to in writing, software |
| rahul_dahiya |
0:fb8047b156bb | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| rahul_dahiya |
0:fb8047b156bb | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| rahul_dahiya |
0:fb8047b156bb | 13 | * See the License for the specific language governing permissions and |
| rahul_dahiya |
0:fb8047b156bb | 14 | * limitations under the License. |
| rahul_dahiya |
0:fb8047b156bb | 15 | */ |
| rahul_dahiya |
0:fb8047b156bb | 16 | #include "FileHandle.h" |
| rahul_dahiya |
0:fb8047b156bb | 17 | #include "platform/mbed_retarget.h" |
| rahul_dahiya |
0:fb8047b156bb | 18 | #include "platform/mbed_critical.h" |
| rahul_dahiya |
0:fb8047b156bb | 19 | |
| rahul_dahiya |
0:fb8047b156bb | 20 | namespace mbed { |
| rahul_dahiya |
0:fb8047b156bb | 21 | |
| rahul_dahiya |
0:fb8047b156bb | 22 | off_t FileHandle::size() |
| rahul_dahiya |
0:fb8047b156bb | 23 | { |
| rahul_dahiya |
0:fb8047b156bb | 24 | /* remember our current position */ |
| rahul_dahiya |
0:fb8047b156bb | 25 | off_t off = seek(0, SEEK_CUR); |
| rahul_dahiya |
0:fb8047b156bb | 26 | if (off < 0) { |
| rahul_dahiya |
0:fb8047b156bb | 27 | return off; |
| rahul_dahiya |
0:fb8047b156bb | 28 | } |
| rahul_dahiya |
0:fb8047b156bb | 29 | /* seek to the end to get the file length */ |
| rahul_dahiya |
0:fb8047b156bb | 30 | off_t size = seek(0, SEEK_END); |
| rahul_dahiya |
0:fb8047b156bb | 31 | /* return to our old position */ |
| rahul_dahiya |
0:fb8047b156bb | 32 | seek(off, SEEK_SET); |
| rahul_dahiya |
0:fb8047b156bb | 33 | return size; |
| rahul_dahiya |
0:fb8047b156bb | 34 | } |
| rahul_dahiya |
0:fb8047b156bb | 35 | |
| rahul_dahiya |
0:fb8047b156bb | 36 | std::FILE *fdopen(FileHandle *fh, const char *mode) |
| rahul_dahiya |
0:fb8047b156bb | 37 | { |
| rahul_dahiya |
0:fb8047b156bb | 38 | return mbed_fdopen(fh, mode); |
| rahul_dahiya |
0:fb8047b156bb | 39 | } |
| rahul_dahiya |
0:fb8047b156bb | 40 | |
| rahul_dahiya |
0:fb8047b156bb | 41 | } // namespace mbed |