>This is what you propose as a solution? Wake up and smell the coffee. The code as written was the OP's attempt to use *your* method. I never offered any code fragments as you have done - I made suggestions to overcome specific problems the OP posted. My suggestions worked - correctly. At no time was my 'mandate' to completely debug or rewrite the OP's code. The 3000 and other details are not my suggestion, as should be clear to anyone who looked at the before and after code.

My sole suggestion in that post was to add the newline to the string, in order to correct 'the alignment of the text file'. Is this a diversionary tactic to avoid acknowledging the problems with the code you posted? Giving a neophyte programmer code which has bugs, not alerting the recipient that the bugs exist, and saying: 'Make it. (like this)' is not exactly helpful. Neither is refusing to test your own code and to admit that it's defective. It's just blind luck and not good programming that the erroneous assumption that the getline will always succeed had no effect on the output in this case.

Since getline clears the receiving string - gives it a length of zero - when it fails, the extra concatenation attempt effectively does nothing. But put any other code after the getline and you might not be so lucky. No such luck saved your other mistake from compromising the output. Using getline with a 'text' file opened in binary mode drops characters from the file, as a simple comparison of the file sizes before and after copying will easily reveal. I don't call that code that 'works'.

Delete A File From The Ifstream

• • • • ifstream Input stream class to operate on files. Objects of this class maintain a object as their internal stream buffer, which performs input/output operations on the file they are associated with (if any). File streams are associated with files either on, or by calling member. This is an instantiation of with the following template parameters: template parameter definition comments charT char Aliased as member char_type traits Aliased as member traits_type Apart from the internal, objects of this class keep a set of internal fields inherited from, and: field member functions description Formatting format flags A set of internal flags that affect how certain input/output operations are interpreted or generated. See member type. Field width Width of the next formatted element to insert. Display precision Decimal precision for the next floating-point value inserted.

Locale The object used by the function for formatted input/output operations affected by localization properties. Fill character Character to pad a formatted field up to the field width ( ). Emachines E627 Touchpad Drivers. State error state The current error state of the stream.

Individual values may be obtained by calling,, and. Install Asterisknow From Usb Stick. See member type. Exception mask The state flags for which a exception is thrown.

See member type. Other callback stack Stack of pointers to functions that are called when certain events occur. Extensible arrays Internal arrays to store objects of type long and void*.

Tied stream Pointer to output stream that is flushed before each i/o operation on this stream. Stream buffer Pointer to the associated object, which is charge of all input/output operations.

Character count Count of characters read by last unformatted input operation.

Sign in to vote. Sign in to vote. Read file with std::ifstream. Use std::getline to write file contents in std::string. Delete last character from the string using method erase(). Write the string in output file with std::ofstream. Monday, October 03, 2011 12:04 PM. //Remove a file #includeiostream.h. Coutfile to delete: '. Function takes the name of a file as its argument.