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.

Frage zur Handhabung mit Dateien

Empfohlene Antworten

Du hast doch strtok schon benutzt. Beim ersten Aufruf übergibst du line, für die nachfolgenden Aufrufe NULL als ersten Parameter.

Generally, strtok() is not recommended. It works only on C-style

strings. It modifies the string. It can't be used with constant strings

or string literals. It has concurrency and reentrancey problems.

bzw.

Also, strtok has one really good use. It teaches newbies what

not to do, by biting them in the ass. Get hold of a good description

of strtok and read up on such things as: Buffer over runs as a

substantial security risk. Static buffers shared between different

calls to strtok as a data corruption risk. And so on.

War mir zwar neu, aber man lernt halt nie aus.

strncpy und sprintf schaffen Abhilfe:

strncpy(new,alt+position,länge);

sprintf(new,"%-10.10s,alt+position);

Geschmacksfrage.:rolleyes:

Ansonsten mal Freund Google befragen, gibts massig Algorithmen.

Bei den Zitaten von bytes.com solltest du darauf hinweisen, dass es da um C++ geht. Darin stimme ich zu: In C++ sollte man strtok wirklich nicht benutzen.

In C sehe ich das weniger kritisch. Man muss bei der Verwendung von strtok wissen, was man tut, aber das muss man in C sowieso allgemeiner als bei C++.

It works only on C-style strings
Richtig. Was anderes haben wir in C auch nicht ;)

It modifies the string.
Richtig. Muss man halt wissen.

It can't be used with constant strings or string literals.
Das folgert direkt aus dem vorigen Punkt. Ist hier nicht relevant.

It has concurrency and reentrancey problems.
Genauer gesagt, die Funktion ist weder reentrant noch threadsafe. Beides ist hier nicht von Bedeutung. Trotzdem muss man das natürlich wissen.

strncpy ist übrigens auch nicht ohne. Diese Funktion setzt nämlich manchmal eine Nullterminierung, und manchmal nicht.

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.