|
|
|
|
|||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
parsing a big string in smaller strings.
Hi All,
I want to parse a big string char Big_String[150]; into small strings char Small_String[30][5] ; I mean to say that Small_String are separated by spaces in the Big_String and i want to save them them in five different Small_Strings. There may be 1,2,3 4 or 5 [ at max] Small_Strings present in the Big_String. Please write a compact subroutine for me. TIA, Shishir |
|
#2
|
|||
|
|||
|
parsing a big string in smaller strings.
Shishir wrote:
Hi All, > I want to parse a big string > char Big_String[150]; > into small strings > char Small_String[30][5] ; > > I mean to say that Small_String are separated by spaces in the Big_String and i want to save them them in five different Small_Strings. There may be 1,2,3 4 or 5 [ at max] Small_Strings present in the Big_String. Then why have you declared Small_String as appropriate for 30 strings of at most 4 bytes each? Please write a compact subroutine for me. We don't tend to do homework on request |
|
#3
|
|||
|
|||
|
parsing a big string in smaller strings.
Shishir wrote:
Hi All, > I want to parse a big string > char Big_String[150]; (Nitpick: that's not automatically a string; it's a char array. It's not a string unless there's null termination inside it.) (Stylepick: one can use camelCase; one can use underlined_form; trying to use them both simultaneously seems to be a computational marmite ice-cream.) into small strings > char Small_String[30][5] ; > > I mean to say that Small_String are separated by spaces in the Big_String and i want to save them them in five different Small_Strings. There may be 1,2,3 4 or 5 [ at max] Small_Strings present in the Big_String. So the big string has space-separated small strings in it, K. Please write a compact subroutine for me. This is not a Do My Work For Me group. But I suggest that you look at the [specification of the] standard function `strtok`. -- Chris "def compact() =();" Dollin Hewlett-Packard Limited registered no: registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England |
|
#4
|
|||
|
|||
|
parsing a big string in smaller strings.
Chris Dollin wrote:
Shishir wrote: > >I mean to say that Small_String are separated by spaces in the >Big_String and i want to save them them in five different >Small_Strings. There may be 1,2,3 4 or 5 [ at max] Small_Strings >present in the Big_String. But I suggest that you look at the [specification of the] standard function `strtok`. > I was considering an evil solution, writing the original string to a file, converting space to EL on output and then reading the file a line at a time |
![]() |
| Viewing: Web Development Archives > FAQs > C/C++ > parsing a big string in smaller strings. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|