Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

w+b ? #181

Open
alexzk1 opened this issue Dec 25, 2023 · 2 comments
Open

w+b ? #181

alexzk1 opened this issue Dec 25, 2023 · 2 comments

Comments

@alexzk1
Copy link

alexzk1 commented Dec 25, 2023

I'm trying to write normal C++ code implementing this idea.
So I found something weird into library used:

 with open(EC_IO_FILE,'w+b') as file:
        file.seek(BYTE)
        file.write(bytes((VALUE,)))

Are you sure it should be w+b ? Because

"w+"

Creates an empty file for both reading and writing.

So it should truncate content, then seek looks useless there.

@YoCodingMonster
Copy link
Owner

w+b for createing and writing the file
same as w+

@alexzk1
Copy link
Author

alexzk1 commented Dec 25, 2023

w+b for createing and writing the file same as w+

Yes, that what I said. If you do that with normal file it will get 0 length. So following "seek" has no sense then. debug fs may ignore "truncate" request, but that does not cancel the fact code tries to do it. Looks like bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants