Results 1 to 3 of 3

Thread: Files and strings in C

  1. #1
    Join Date
    May 2012
    Posts
    2

    Exclamation Files and strings in C

    Hello friends,
    I am a begineer in C language and I have to create a program which perform the following:
    The program should takes as input 1 paragraph that is stored in a file (input.txt) and that checks the wording. The program should use the dictionary available in the file (dictionary.txt). And the the program must check the input file word by word and make sure the words exist in the dictionary. If a word contains a mistake it must be corrected. Finally, that program must output to the screen the correct paragraph.

    I am really stack, and I really need your help.

    Thank you very much

  2. #2
    Join Date
    Jan 2006
    Posts
    605

    Re: Files and strings in C

    You can use fgets to read a line into a character array. Then youI would string copy the section that I wanted into a second character array. Something like this might work for you:

    char* source="1 This is the string 2 3 4";
    char destination[26]={0};
    strncpy(destination, source+10, 25);
    printf("\"%s\"\n", destination);

    The output on my system is:

    "This is the string "

  3. #3
    Join Date
    May 2012
    Posts
    2

    Re: Files and strings in C

    Thank you for your help.But I have another sugestion:If I use the Tokenizer.

Similar Threads

  1. Difference between two strings
    By Aman 1 in forum Software Development
    Replies: 5
    Last Post: 03-12-2013, 11:29 AM
  2. How to use Strings in Python
    By Edmund-Windows in forum Software Development
    Replies: 5
    Last Post: 31-12-2010, 05:55 AM
  3. Struct and Strings in C
    By Ash maker in forum Software Development
    Replies: 5
    Last Post: 05-04-2010, 12:01 PM
  4. How to Compare Two Strings in C
    By Pratim in forum Software Development
    Replies: 3
    Last Post: 28-12-2009, 10:40 AM
  5. Array of Strings in C++
    By Jaden in forum Software Development
    Replies: 3
    Last Post: 25-10-2008, 01:48 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,638,999,193.02481 seconds with 17 queries