sl@0: /* sl@0: * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * FUNCTION sl@0: * <>---record position in a stream or file sl@0: * INDEX sl@0: * fgetpos sl@0: * ANSI_SYNOPSIS sl@0: * #include sl@0: * int fgetpos(FILE *<[fp]>, fpos_t *<[pos]>); sl@0: * TRAD_SYNOPSIS sl@0: * #include sl@0: * int fgetpos(<[fp]>, <[pos]>) sl@0: * FILE *<[fp]>; sl@0: * fpos_t *<[pos]>; sl@0: * Objects of type <> can have a ``position'' that records how much sl@0: * of the file your program has already read. Many of the <> functions sl@0: * depend on this position, and many change it as a side effect. sl@0: * You can use <> to report on the current position for a file sl@0: * identified by <[fp]>; <> will write a value sl@0: * representing that position at <<*<[pos]>>>. Later, you can sl@0: * use this value with <> to return the file to this sl@0: * position. sl@0: * In the current implementation, <> simply uses a character sl@0: * count to represent the file position; this is the same number that sl@0: * would be returned by <>. sl@0: * RETURNS sl@0: * <> returns <<0>> when successful. If <> fails, the sl@0: * result is <<1>>. Failure occurs on streams that do not support sl@0: * positioning; the global <> indicates this condition with the sl@0: * value <>. sl@0: * PORTABILITY sl@0: * <> is required by the ANSI C standard, but the meaning of the sl@0: * value it records is not specified beyond requiring that it be sl@0: * acceptable as an argument to <>. In particular, other sl@0: * conforming C implementations may return a different result from sl@0: * <> than what <> writes at <<*<[pos]>>>. sl@0: * No supporting OS subroutines are required. sl@0: * sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: #include sl@0: /** sl@0: Get position in a stream. sl@0: @return 0 value indicates success. non-zero value indicates error. sl@0: @param fp pointer to an open file. sl@0: @param pos pointer to a fpos_t object where the position will be stored. sl@0: */ sl@0: EXPORT_C int sl@0: fgetpos (FILE * fp, fpos_t * pos) sl@0: { sl@0: *pos = ftell (fp); sl@0: sl@0: if (*pos != -1) sl@0: return 0; sl@0: return 1; sl@0: }