TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG:10354] c question
Use fgets.
int i=0;
while(fgets(buffer, length, input)) {
array[i++] = buffer;
}
----- Original Message -----
From: bliss <bliss@treewax.com>
To: <tclug-list@mn-linux.org>
Sent: Monday, November 22, 1999 2:19 PM
Subject: [TCLUG:10354] c question
> i have a file server.list that contains server names
> server1
> server2
> and i need to initialize an array to those strings
> array[0] = "server1";
> array[1] = "server2";
> but i want to do this dynamicly, ie i want this program to read the file
and
> assign each string to the array subscript
> array[0] --> server1 while reading the file
> how do i get a line and assign a string to an array
> then move forward in the array and assign the next string to the next
space
> in the array?
>
> any ideas ???
>
> --chris engstrom
> bl155@treewax.com
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe@mn-linux.org
> For additional commands, e-mail: tclug-list-help@mn-linux.org
>