Thread: removing the iiiiiiiiiiiiiii's

  1. #1
    JC++
    Guest

    Unhappy removing the iiiiiiiiiiiiiii's

    everytime i use fwrite() to write a string into a TXT file, when i open it, i always see a lot of iiiiiiiiiiiiiiiiiis in the file. Is there any way to remove it?

    i tot maybe its becos i wrote the entire structure into the file. but if i try writing a string into the file instead, it works and all the iiiiiiiiiiiiiis disappear. But after that when i want to use fread to retrieve each row of text, i cannot determine how large that row of text is and take out the required amount of data... can anyone help me pls?

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    yes dont use fread() and fwrite for text files. They are for binary input/output.
    Instead use fprintf() and fscanf() or fgetc() or fputc() or fgets() and fputs() etc. You will probably need to write a delimiter char after the string to make life easy. Then just read up to the delimeter and discard the delimiter and your there.
    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. special characters removing from srting
    By cnu_sree in forum C Programming
    Replies: 5
    Last Post: 06-06-2007, 08:30 PM
  2. Removing Leading & Trailing Whitespace
    By EvilGuru in forum C Programming
    Replies: 11
    Last Post: 12-01-2005, 02:59 PM
  3. Removing from the front of a Vector
    By Zildjian in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2004, 10:49 AM
  4. Removing text between /* */ in a file
    By 0rion in forum C Programming
    Replies: 2
    Last Post: 04-05-2004, 08:54 AM
  5. Removing a header from a file
    By JamesK in forum Windows Programming
    Replies: 3
    Last Post: 05-26-2003, 05:13 PM