[LUGOS-PROG] C newbie

David Ipavec david.ipavec at amis.net
Sun Feb 23 15:25:45 CET 2003


On Thu, Feb 20, 2003 at 07:46:26PM +0100, Nejc Skoberne wrote:

> Matram se ze par ur... kako bi izgledal program, ki bi iz datoteke
> prebral posamezne vrstice in jih zapisal vsako kot string v array stringov? V Cju.

char **niz;
char **p;

niz=calloc( sizeof( *niz ) * max_st_vrstic );
if( niz==NULL ) exit();

p=niz;

while(1){
  
  size=getline(p, &len, fp);
  if( size==-1) break;
  p++;
  if( p-niz+1 > max_st_vrstic) break;
}


-- 
 David Ipavec <david.ipavec at amis.net>  
 PGP/GnuPG Public Key available at keyserver
 Fingerprint: 621C 1C52 417D 2EFA 3D00  A4CF 9958 F779 61EC 9D5E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://liste2.lugos.si/pipermail/lugos-prog/attachments/20030223/69e95471/attachment-0001.pgp


More information about the lugos-prog mailing list