-
echo command
Hello
How can I create a text file by using dos commands?
I am trying to use echo command such as
echo Hello > test.txt
echo Hi, how are you? >> test.txt
But, the echo doesn't put any null terminator at the end of string.
When I check the string length of each, it should be 5 for Hello.
It is not, it become the length of buffer that read the line.
Anyone, please give me a suggestion.
Thank you.
Pong
-
Refugee
Try this....
#include <iostream>
#include <fstream>
using namespace std;
main()
{
ofstream output;
//opens file 'file.txt' for writing to.
output.open("file.txt");
//writes information to the file 'file.txt'
output << "Hello";
//closes the output file 'file.txt'
output.close();
}
This should help (I hope)
-Chris
Last edited by face_master; 08-31-2001 at 07:33 PM.
-