Foros - Stratos

Programadores => General Programadores => Mensaje iniciado por: Ogl2k en 21 de Octubre de 2002, 12:38:20 PM

Título: Problemillas con fscanf()
Publicado por: Ogl2k en 21 de Octubre de 2002, 12:38:20 PM
                                Tengo problemas al usar fscanf() bajo Visual C++. Leo una linea desde un archivo perfectamente pero al volver a usar fscanf() me falla.

¿Alguna idea o alguna otra funcion mejor que fscanf para leer archivos de texto?.                                
Título: Problemillas con fscanf()
Publicado por: sés en 21 de Octubre de 2002, 01:18:40 PM
                                Yo uso:

char *fgets(char *s, int n, FILE *stream);

Lee una línea de n caracteres como máximo.

Ayuda de Borland

Header File
stdio.h

Category
Input/output Routines

Syntax
#include
char *fgets(char *s, int n, FILE *stream);
wchar_t *fgetws(wchar_t *s, int n, FILE *stream); // Unicode version

Description
Gets a string from a stream.

fgets reads characters from stream into the string s. The function stops reading when it reads either n - 1 characters or a newline character whichever comes first. fgets retains the newline character at the end of s. A null byte is appended to s to mark the end of the string.

Return Value
On success fgets returns the string pointed to by s; it returns NULL on end-of-file or error.