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.

Was mache ich hier falsch?

Empfohlene Antworten

Veröffentlicht

Hi,

also ich habe da mal wieder ein total dummes Problem, denke ich, und ein Brett vor'm Kopf, aber ich komme einfach nicht weiter. Ich will aus der Datei heraus Zeichenweise einlesen, solange bis ein Leerzeichen kommt, und will das gelesene in einem Array speichern, und dieses dann mitetwas vergleichen. Sieht bei mir so aus:

fz = fopen ("c:\\blablabla.txt", "r");

while ((c = fgetc (fz)) != EOF);

{

while (c != ' ')

{

buffer1[pos] = c;

pos++;

}

buffer1[pos] = '\0'

_strlwr(buffer1);

.

.

.

}

Er bleibt jetzt immer in der inneren while Schleife hängen, und ich weiß nicht wieso, und kann es nicht ändern. Habe es auch schon mit anderen Schleifen probiert, aber es klappt einfach nicht. Liegt es an der Typkonvertierung, und wenn ja, wie kann ich das ändern?

Bine

Hi,

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Zitat:</font><HR> while ((c = fgetc (fz)) != EOF);

{

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Zitat:</font><HR>Original erstellt von Woodstock:

<STRONG>

while (c != ' ')

{

buffer1[pos] = c;

pos++;

}

</STRONG>

So, ich habe es...

#include "Sabine(1).h"

void main()

{

FILE *fz;

char **DA = NULL;

int scnt = 0;

char Eingabe[2];

char c = 1;

char buffer1[100] = {NULL};

int pos = 0;

int Fehler = 2;

cin >> Eingabe;

_strlwr (Eingabe);

fz = fopen ("c:\\blablabla.txt", "r");

while (c != EOF)

{

c = fgetc (fz);

if (c == ' ' || c == ',')

{

_strlwr(buffer1);

if(strstr (buffer1, Eingabe))

{

Fehler = 0;

break;

}

else

Fehler = 1;

pos = 0;

}

buffer1[pos] = c;

pos++;

buffer1[pos] = '\0';

}

if (Fehler == 0)

cout << "\nSuchbegriff gefunden!" /*<< Datei[j] */<< "\n\n";

}

klappt jetzt so... thnx :)

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.