How to split char* into array in c++?

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Onaylı Üye
Katılım
6 Tem 2022
Mesajlar
51
Tepki puanı
8
Yaş
27
3 HİZMET YILI
code:
Kod:
char* path = entity->m_Opath;

the result of path is "Gameplay/Vehicles/AH6/AH6_Littlebird"

I need to split this into an array using "/" as separator. How i can do this?
 
Onaylı Üye
Katılım
6 Tem 2022
Mesajlar
50
Tepki puanı
3
Ödüller
1
Yaş
37
3 HİZMET YILI
#include<string.h> #include<stdio.h> int main() { char* input = entity->m_Opath; char *p; p = strtok(input, "/"); }
 
Onaylı Üye
Katılım
17 Nis 2019
Mesajlar
50
Tepki puanı
1
Ödüller
5
Yaş
38
7 HİZMET YILI
#include<string.h>
#include<stdio.h>
int main()
{
char input[16] = "abc,d";
char *p;
p = strtok(input, ",");

if(p)
{
printf("%s\n", p);
}
p = strtok(NULL, ",");

if(p)
printf("%s\n", p);
return 0;
}
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...