Skip to content

Commit 58ec8f8

Browse files
committed
fix the seek cursors
1 parent 062dacc commit 58ec8f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

FileRW/main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int main(void) {
2424
if (opt == "w" || opt == "W") {
2525
// clear flags and set put cursor at eof
2626
file->clear();
27-
file->seekp(std::ios::end);
27+
file->seekp(0, std::ios::end);
2828

2929
std::string data;
3030
std::cout << "Enter string: ";
@@ -33,7 +33,7 @@ int main(void) {
3333
} else if (opt == "r" || opt == "R") {
3434
// clear flag and set get cursor at begining of file
3535
file->clear();
36-
file->seekg(std::ios::beg);
36+
file->seekg(0, std::ios::beg);
3737

3838
std::string data;
3939

0 commit comments

Comments
 (0)