Thread: text line termination

  1. #1
    Unregistered
    Guest

    Post text line termination

    How do I remove a line of text in a text file pointed to by a FILE pointer without removing any other text.

    i,ve got.

    FILE f_ptr;

    f_ptr-fopen("filename","a+")
    fseek(f_ptr,0,SEEK_SET); /* file beginning */

    /* need to remove line of text here and move all subsequent lines up by a line or write to this removed line space later in prog */

    thx for the help.

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    247
    Depends what you are reading is it an array of strings or structure post the remainder of your code so we can see.
    hoping to be certified (programming in c)
    here's the news - I'm officially certified.

  3. #3
    Registered User
    Join Date
    Sep 2001
    Location
    Fiji
    Posts
    212
    if you wanna remove a line of text first of all declare file like this

    Code:
    FILE *fileptr = fopen("file.txt","r+");/* Allows you to read and write to a file.*/
    Then find the start of the line you want and do want you want to do.

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Or try this psuedocode:

    for(...Iteration... )
    { fgets(Array,Size,FILE* ); }

    //close file

    //...declare another array...copy selectively... //
    for(...Iteration... )
    { ...Print New Array... }
    Last edited by Sebastiani; 09-09-2001 at 04:41 AM.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading text file by line number
    By whiskedaway in forum C++ Programming
    Replies: 13
    Last Post: 06-16-2009, 10:09 AM
  2. DirectX | Drawing text
    By gavra in forum Game Programming
    Replies: 4
    Last Post: 06-08-2009, 12:23 AM
  3. Is there any way to read a line from a text file?
    By megareix in forum C Programming
    Replies: 13
    Last Post: 01-09-2009, 01:13 PM
  4. How do I make my edit box move text to the next line?
    By ElWhapo in forum Windows Programming
    Replies: 2
    Last Post: 01-04-2005, 11:21 PM
  5. inputting line of text vs. integers in STACK
    By sballew in forum C Programming
    Replies: 17
    Last Post: 11-27-2001, 11:23 PM