Please help me with a code that replaces everything on a specific col

This is a discussion on Please help me with a code that replaces everything on a specific col within the C++ Programming forums, part of the General Programming Boards category; I also want to say that: std::ios::ate doesn't work at all, it doesn't output anything. Well, as I said I ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    367

    Please help me with a code that replaces everything on a specific col

    I also want to say that: std::ios::ate doesn't work at all, it doesn't
    output anything.

    Well, as I said I want everything on a specific col in a document to be erased and then replaced with other bytes on just that col, like col 252.

    How do you do it?

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    read the file into memory. make the alterations you want. write the file back out to media again.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    367

    Please be more specific

    In this case I want to replace everything on col 252 with some other text, shall I use goto. This can't be very hard for you experienced programmers, please help me.

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    1) get file length.
    2) allocate space to read file into of file length bytes.
    3) read in file to allocated space ( dynamic array)
    4) make alterations as you would to any array
    5) write the array out to disc.
    6) free the memory used to read the file into.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  2. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 03:28 AM
  3. Seems like correct code, but results are not right...
    By OmniMirror in forum C Programming
    Replies: 4
    Last Post: 02-13-2003, 12:33 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Malloc
    By chaitu in forum C Programming
    Replies: 12
    Last Post: 05-15-2002, 11:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21