Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 09-20-2005, 06:12 AM   #1
Registered: Sep 2005
Posts: 145

Rep: Reputation: 15
Learn English with a C program

I'd like to write a program that keeps track of English works that I have learned so that I can do a self-test periodically. Could you tell me anything that can be changed in the source, for exemple the coding style or a more efficient syntax. Sorry about uncompleted command it's due to the lack of knowledge, just if you don't mind to suggest some alternatives to complete it.
#include <stdio.h>
enter_new_word() {
	char s[20];
	FILE *f;
	/*Open the file for appending*/
	/*If user enter "test" then go to the next function*/
	printf("Enter a new word: ");
	/*Eeceive the work ? */
	/*Append the word in the file*/
	/*Close the file*/
vocabulary_test() {
	FILE *f;
	char s[20];	
	/*Open f for reading*/
	while (EOF == 0) {
		/*Scan the word to s*/
		printf("\nDo you remember the definitions of %s\n",s);

main() {
Old 09-20-2005, 12:53 PM   #2
Registered: May 2002
Location: dracut MA
Distribution: Fedora, RHEL
Posts: 600

Rep: Reputation: 109Reputation: 109
Why not store the whole thing in the file?

I'm thinking something like this:

typedef struct t_dict_ent {
int w_len;
int d_len;
char *word;
char *defin;
} dictent;

then do:

dictent *pentry = malloc(sizeof(dictent)+strlen("test")+strlen("this is a test"));
entry->d_len=strlen("this is a test");
strcpy(entry->word, "test");
strcpy(entry->defin, "this is a test");

then you can fwrite pentry. when you read it in, you'll get the word, and the definition.

just a suggestion


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Way to use a good free English to English Dictionary linbose Linux - Software 6 06-03-2009 11:25 PM
i want to learn to program... trey85stang Programming 13 01-07-2005 02:22 PM
Can I have english menu with chinese/english/spanish input? codec Linux - General 9 10-04-2003 08:18 PM
Want to learn to Program Tenover Linux - Newbie 13 03-28-2003 03:38 PM
any programmers who had to fight hard to learn to program? Flotilla Programming 14 01-21-2003 07:49 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:34 PM.

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