LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-24-2010, 01:41 AM   #1
hennipaste
LQ Newbie
 
Registered: Jan 2010
Posts: 9

Rep: Reputation: 0
Printing text from an external file in C


Hi, I was reading through the source code of adventure in the bsdgames package and I had noticed that most of the text is read from a file called glorkz. I'm wondering about what function/technique the author used to print from the file; I've been looking through the code for a while (particularly io.c) and I haven't been able to figure it out.

Thanks.
 
Old 05-24-2010, 04:53 AM   #2
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
Take a look to the <stdio.h> (man stdio.h)
 
Old 05-24-2010, 07:01 AM   #3
hennipaste
LQ Newbie
 
Registered: Jan 2010
Posts: 9

Original Poster
Rep: Reputation: 0
It doesn't really help =/. The file glorkz isn't actually accessed during execution, I think it's compiled with the rest of the program. All of the output sentences and input vocabulary are put into this file, I can't seem to work out how they're all accessed within the program itself though. This way certainly seems more efficient than using printf over and over again if you need a lot of text output (which I do).

Last edited by hennipaste; 05-24-2010 at 07:03 AM.
 
Old 05-24-2010, 07:59 AM   #4
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
A quick look in the Makefile says that "glorkz" is converted by the "setup" program to C source code
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Variables in text file, how to get their values when printing out the text? idaham Linux - General 2 04-14-2010 03:28 AM
Urgent! Writing to external text file with C or C++ NewbatC Linux - Newbie 7 05-19-2009 01:42 AM
problem with C (printing out to text file) manolakis Programming 10 02-06-2007 02:22 AM
reading and printing out a text file in html mrobertson Programming 1 07-08-2005 11:47 PM
Printing numbers from a text file dynamically mrobertson Programming 1 06-28-2005 08:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration