Thread: How to Extract data from text file, modify data in a text file and save it

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    2

    Cool How to Extract data from text file, modify data in a text file and save it

    Hi,

    I have got two problems with file operations.

    (1) how to read data from a text file into a matrix from second line

    txt file like this:

    a b c d
    1 2 3 3
    5 6 6 7

    I want to get x= [ 1 2 3 3; 5 6 6 7] for calculation from the text file.

    (2) How to modify some real numbers in a text file and save it for another use.

    txt file like this:

    a
    b
    1.1
    2.1
    4.6
    6.8

    I want to modify these real numbers: 1.1 2.1 4.6 6.8 to other real numbers, say 2.1 3.0 8.0 9.2, and save these changes in this text file for running other program.

    Thanks for your help!
    Shark
    Last edited by sharkman; 05-25-2011 at 05:36 PM.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    It must be really hard being a completely blind programmer. Because if you weren't blind, you would have seen this link right at the top of the list when you posted: Extracting Information from Files


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    May 2011
    Posts
    2
    Quote Originally Posted by quzah View Post
    It must be really hard being a completely blind programmer. Because if you weren't blind, you would have seen this link right at the top of the list when you posted: Extracting Information from Files


    Quzah.
    I saw the post but I expect to have a clear answer (original C program or simple solutions) about the problems from others.
    Thanks!

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You expect us to do it for you? Good luck with that.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading data from Text File
    By DarrinTE in forum C Programming
    Replies: 8
    Last Post: 03-25-2011, 03:11 PM
  2. Remove data from text file
    By beon in forum C++ Programming
    Replies: 2
    Last Post: 05-17-2007, 08:53 PM
  3. Replies: 4
    Last Post: 01-03-2006, 03:02 AM
  4. Replies: 1
    Last Post: 10-30-2002, 05:45 AM
  5. create a text file with data using text editor
    By fried egg in forum C Programming
    Replies: 3
    Last Post: 03-14-2002, 09:11 PM