[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Split char i C/C++



Christian Brønnum-Hansen wrote:
Hej!

Jeg har en char der foreksempel kan være på 150 tegn.
Hvordan måler jeg længden af en char og hvordan deler jeg den op?
Hvis der altså er en funktion til det.
Ellers må jeg jo bare lave en løkke der putter hver eneste tegn ind i
den rigtige char men det synes jeg er lidt voldsomt...

Lige for at få det på plads, så er en 'char' altså kun et tegn. Du har måske et array af char eller en char *

Okay, jeg antager at du har en nul-termineret tekst-streng.
Sådane kan kopieres med strcpy eller strncpy eller memcpy.
Du skal dog være opmærksom på at du skal sikre dine del-strenge bliver nul-termineret.
Der findes en række andre funktioner der opererer på strings. De hedder typisk noget med str*().
Prøv fx. i en terminal/shell at give kommandoen:
apropos str


Med venlig hilsen
Egon Andersen


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *