is seekg and seekp only used for veriables or can you use them for characters as well, if you can't is there a function that does the same type of thing.
cheers wart1010101010101010100011101
is seekg and seekp only used for veriables or can you use them for characters as well, if you can't is there a function that does the same type of thing.
cheers wart1010101010101010100011101
WhAtHA hell Is GoInG ON
neither. They are used for moving to a new location in data files. see fstream descriptions.
sorry i didn't ask the question properly i wanted to know if you could use the seekp and seekg functions to output characters or is it just used for variables. and i do apolagise as i am a newbie....
WhAtHA hell Is GoInG ON
I'll repeat what was said earlier:
The seekp and seekg functions are only used to move the put/get pointers within a stream. The functions you would use to perform actual output would typically be either the stream's insertion operator(<<), or the put member function. They can all be used with either a variable or a hardcoded value:Originally Posted by Ancient Dragon
Code:char c = 'A'; ofstream strm("file.txt"); strm.put('B'); // Writes the character 'B' to the stream strm.put(c); // Writes the character 'A' to the stream strm << 'B'; // Writes the character 'B' to the stream strm << c; // Writes the character 'A' to the stream
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
ok soz,,thats much clearer,,,,,,,,,,,,,,,,,cheers
WhAtHA hell Is GoInG ON