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.

char [256] to int

Empfohlene Antworten

Veröffentlicht

hi .

wie bekomme ich eine char[] variable in einen integer wert...


char test[256]

int int_test

Danke

#include <stdlib.h>


int int_test = atoi(test);

Sei dir aber klar, daß nicht alle 256 Ziffern genommen werden, so große ints gibt es net. Und es sollten natürlich nur Ziffern in test stehen.

#include <stdlib.h>


int int_test = atoi(test);
Sei dir aber klar, daß nicht alle 256 Ziffern genommen werden, so große ints gibt es net. Und es sollten natürlich nur Ziffern in test stehen.
Hi hatte ich schon folgende Kompilierungsfehler
'atoi' : Konvertierung des Parameters 1 von 'unsigned char [256]' in 'const char *' nicht moeglich

solltest du höhere Werte wirklich brauchen, dann mach aus int_test nen long long int und nim atoll()

@hobbes Zeichen sind egal, nur ab dem ersten Zeichen was auftaucht wird jeglicher rest ignoriert.

@given_to_fly Hier hast mal n Bsp:

#include <stdio.h>

#include <stdlib.h>


int main()

{

  char test[256];

  int int_test;


  strcpy(test, "12335bdf4647\0");


  puts(test);

  int_test = atoi(test);

  printf("%i\n",int_test);


  system("PAUSE");	

  return 0;

}

Lief bei mir anstandslos (Dev-C++)

Args. schuldigung der CHAR Wert ist ein UCHAR wert :)

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.