Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Mein Problem ist folgendes:

Mein Programm bekommt beim Start zwei Dateien übergeben, und in einem ersten Test soll ich überprüfen, ob die Datei überhaupt vorhanden ist. Das hat ja noch funktioniert. In einem zweiten Test soll ich aber noch überprüfen ob die Datei auch gefüllt ist, und dabei hapert es jetzt....

Gibt es einen bestimmten Befehl dafür, oder kann mir jemand sagen, was ich für Möglichkeiten habe das zu überprüfen?

Fledermausi

du könntest ja die datei einlesen und dann schauen, ob was drinsteht

Hallo,

dafür gibt es "stat and friends":


#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

int main(int argc, char **argv)
{
struct stat buf;

stat(argv[1], &buf);
printf("Dateigroesse=%d Bytes\n", buf.st_size);
}
[/php]

(Achtung, keinerlei Fehlerprüfung im Code!!!)

Nic

Such mal in der hilfe nach find_t das kann mal wunderschön einbauen. Z.B:

 
#define Fileerror -1
int datei;
int dateiin;

struct find_t find;

...
...
..
Datei=_dos_findfirst(Dateipfad,_A_Normal,&find);
Dateiin=sopen(Dateipfad,O_RDONLY,weitere Argumente);
if (dateiin!=Fileerror){

Dateilaenge=(int)find.size);

if (Dateilaenge=0) {
...
...
}else{
...
...
}


}
[/PHP]

(Wurde nicht auf Fehler überprüft)

MVG

need-some-blood

ohne gewähr:

Kann man den Filepointer nicht auf NULL-Pointer überprüfen?

Hallo,

Nein, geht nicht. Ein Nullpointer als Return-Wert (beim fopen) bedeutet nur, dass die Datei nicht geöffnet werden konnte. Es ist ein großer Unterschied, ob eine Datei existiert und leer ist oder nicht existiert!

Nic

  • 3 Wochen später...

getlength() wollte überhaupt nicht laufen, aber mit nic_power's Lösung hats dann funktioniert!:)

Danke schön!

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.