Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jul 2014 21:14:39 -0700
From:      Gary Kline <>
To:        Polytropon <>
Cc:        FreeBSD Mailing List <freebsd-questions@FreeBSD.ORG>
Message-ID:  <>
In-Reply-To: <>
References:  <> <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
Organization: Thought Unlimited.  Public service Unix since 1986.
Of_Interest: With 28 years  of service  to the  Unix  community.

On Fri, Aug 01, 2014 at 02:37:49AM +0200, Polytropon wrote:
> On Thu, 31 Jul 2014 16:33:35 -0700, Gary Kline wrote:
> > 	what is the easiest way, in C, *knowing the count=N*, to
> > 	grab the *text files and stuff the paragraphs into a global
> > 	buffer:	char *parabuffer[1024]; ??
> Addition:
> For every _desired_ file name you've obtained, do the
> following: fopen() the file in "r" mode, fgets() the
> line (or each line) into a read buffer, maybe postprocess
> the buffer, and then append it to the parabuffer. Use
> strlcat() to make sure you're not crossing the edge of
> the string, so allocate sufficient space. Finally fclose()
> the file when feof() tells you that the end has arrived.
> See "man strcat" on why not to use strcat() or strncat(),
	here's the way I've done it so far:  

	I've used readdir( DIR *d) and more to find the text[n].txt 
	file names.  then, in a 1998 c++ file I find these txt names
	by using essentially  {psedocode): 

		infp = fopen(filename[i], "r")
		   while (fgets(buffer[i], sizeof buffer, infp))

	that's an immediate re-translation from c++ to C.

	thanks, polyt.  I will put this last of several pieces of code
	together until I've got my several buffer[i] copied into the 
	GTK label[i].

	FWIW: the reason I want to have these several "labels" in a
	wudget//widows is to make the program less clumsy.  it does
	work as-is; but it can get clumsy.

 Gary Kline  Public Service Unix
             Twenty-eight years of service to the Unix community.

Want to link to this message? Use this URL: <>