UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

  • Index
  • » C
  • » convert string to array

#1 2007-12-17 02:34 PM

zhn636
Member
Registered: 2007-04-24
Posts: 146

Re: convert string to array

how do we convert a string to an array? that is to say how do we save a string in an array?

Offline

#2 2007-12-17 02:45 PM

biologz
Administrator
From: Puking on the pavement
Registered: 2005-11-02
Posts: 396

Re: convert string to array

You have strtok in strings.h but it modifies your string so you can use g_strsplit instead wich is a glib function. Or you can write your own...


gethostbyintuition() is still a dream of mine

                                                 -- quoted from bash

Offline

#3 2007-12-17 03:08 PM

zhn636
Member
Registered: 2007-04-24
Posts: 146

Re: convert string to array

if I want to write my own function.how can I do? can anyone give me some suggestion? thanks

Offline

#4 2007-12-17 04:04 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: convert string to array

Are you talking about strcpy()?

Or a function that makes an array of words from an input string, basically splitting it at whitespaces?

Offline

#5 2007-12-17 04:24 PM

biologz
Administrator
From: Puking on the pavement
Registered: 2005-11-02
Posts: 396

Re: convert string to array


gethostbyintuition() is still a dream of mine

                                                 -- quoted from bash

Offline

#6 2007-12-17 04:27 PM

zhn636
Member
Registered: 2007-04-24
Posts: 146

Re: convert string to array

thanks ,I see. I can have a try.

Offline

  • Index
  • » C
  • » convert string to array

Board footer

Powered by FluxBB