C End of File in CMD unter Windows 10?

GeneralHanno

Commander
Registriert
Juni 2006
Beiträge
2.538
Hallo,

will meine C Kenntniss auffrischen und bin gerade dabei ein paar C Übungsprogramme zu schreiben, die ich in der CMD ausführe.

Leider kann ich in der CMD kein EOF (End of File) Flag setzen. Ich habe schon etliche Seiten durchgelesen und die kürzel CTRL+Z und CTRL+D scheinen unter Windows 10 nicht mehr zu wirken :freaky:.
Wenn ich CTRL+Z drücke, kommt nur ein ^Z auf dem Bildschirm.

Irgend welche Ideen, wie ich doch noch eine EOF Flag setzen kann?
 
Code:
feof(3) - Linux man page
Name

clearerr, feof, ferror, fileno - check and reset stream status
Synopsis

#include <stdio.h>

void clearerr(FILE *stream);

int feof(FILE *stream);

int ferror(FILE *stream);

int fileno(FILE *stream);

Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

fileno(): _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE

Description

The function clearerr() clears the end-of-file and error indicators for the stream pointed to by stream.

The function feof() tests the end-of-file indicator for the stream pointed to by stream, returning nonzero if it is set. The end-of-file indicator can only be cleared by the function clearerr().

The function ferror() tests the error indicator for the stream pointed to by stream, returning nonzero if it is set. The error indicator can only be reset by the clearerr() function.

The function fileno() examines the argument stream and returns its integer descriptor.

For nonlocking counterparts, see unlocked_stdio(3).
Errors

These functions should not fail and do not set the external variable errno. (However, in case fileno() detects that its argument is not a valid stream, it must return -1 and set errno to EBADF.)
Conforming To

The functions clearerr(), feof(), and ferror() conform to C89 and C99.
Ergänzung ()

Auch ist es heute nicht mehr nötig ein EOF Zeichen am Ende der Datei zu haben... Das hat man 1980 in Fortran auf ner VAX so gemacht, da das Dateisystem nicht wusste, wann die Datei zu ende ist...
 
Die Länge einer Stapeldatenverarbeitungsdatei, die ja nichts weiter als eine Textdatei ist, wird beim Speichern im Dateisystem vermerkt. ^Z hat eher was damit zu tun, das Dateiende bei direkter Eingabe einer Textdatei in der Eingabeaufforderung zu markieren.
Code:
copy con hello.cmd
@echo Hello World!^Z
 
Zurück
Oben