| Description position = ftell(fid) returns the location of the file position indicator for the file specified by fid, an integer file identifier obtained from fopen.The position is a nonnegative, zero-based integer specified in bytes from the beginning of the file. A returned value of -1 for position indicates that the query was unsuccessful; use ferror to determine the nature of the error. Remarks ftell is likely to return an invalid position when all of the following aretrue. This is duetothe wayinwhich theMicrosoft® Windows® C library currently handles its ftell and fgetpos commands: • The file you are currently operating on is an ASCII text file. • The file was written on a UNIX-based system, or uses the UNIX-style line terminator: a line feed (with no carriage return) at the end of each line of text. (This is the default output format for MATLAB® functions dlmwrite and csvwrite.) • You are reading the file on a Windows system. • You opened the file with the fopen function with mode set to 'rt\ • The ftell command is directly preceded by an fgets or fgetl command. |