When a PC edits file, does it delete original file?
If code.txt (or whatever file) is edited and saved:
[Theory 1] The PC deletes code.txt completely and make new code.txt (edited version) from scratch.
[Theory 2] The PC edits part of hex of code.txt. So no delete happens.
Which theory do computers work?
editing
New contributor
add a comment |
If code.txt (or whatever file) is edited and saved:
[Theory 1] The PC deletes code.txt completely and make new code.txt (edited version) from scratch.
[Theory 2] The PC edits part of hex of code.txt. So no delete happens.
Which theory do computers work?
editing
New contributor
add a comment |
If code.txt (or whatever file) is edited and saved:
[Theory 1] The PC deletes code.txt completely and make new code.txt (edited version) from scratch.
[Theory 2] The PC edits part of hex of code.txt. So no delete happens.
Which theory do computers work?
editing
New contributor
If code.txt (or whatever file) is edited and saved:
[Theory 1] The PC deletes code.txt completely and make new code.txt (edited version) from scratch.
[Theory 2] The PC edits part of hex of code.txt. So no delete happens.
Which theory do computers work?
editing
editing
New contributor
New contributor
New contributor
asked 1 hour ago
Chess ManChess Man
161
161
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Could be either – it depends on the text editor that was used.
The concept of a 'text file' isn't built into computers – each operating system may manage files differently, and each text editor may use those files differently.
In practice, you'll find text editors which have both mechanisms. Simple editors such as Notepad usually just ask the OS to write directly into the original file, as that's easiest to implement – but risky if you lose power mid-write. So for reliability reasons, many editors deliberately save the updated data to a new file and delete the original.
(I think in-place updates are more common among hex editors, where most edits don't insert/delete bytes but only change existing locations, so a full rewrite file is not needed.)
There's even a third mode of operation – the editor might first make a backup copy of the old file, then directly write new data into the file.
It also depends on the filesystem which keeps the file. With most traditional filesystems, if a program asks to write to an existing file, the filesystem will just overwrite old data in-place.
However, some filesystems do work in "copy-on-write" mode, where any new data is always written to a different location, whether the program wants it or not. Again, this has the possible advantage of increased reliability because an interrupted change can be fully reverted.
In some filesystems (such as Btrfs or ext4) this is an optional feature; in others (e.g. log-structured filesystems) it is part of the core design.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Chess Man is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1397186%2fwhen-a-pc-edits-file-does-it-delete-original-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Could be either – it depends on the text editor that was used.
The concept of a 'text file' isn't built into computers – each operating system may manage files differently, and each text editor may use those files differently.
In practice, you'll find text editors which have both mechanisms. Simple editors such as Notepad usually just ask the OS to write directly into the original file, as that's easiest to implement – but risky if you lose power mid-write. So for reliability reasons, many editors deliberately save the updated data to a new file and delete the original.
(I think in-place updates are more common among hex editors, where most edits don't insert/delete bytes but only change existing locations, so a full rewrite file is not needed.)
There's even a third mode of operation – the editor might first make a backup copy of the old file, then directly write new data into the file.
It also depends on the filesystem which keeps the file. With most traditional filesystems, if a program asks to write to an existing file, the filesystem will just overwrite old data in-place.
However, some filesystems do work in "copy-on-write" mode, where any new data is always written to a different location, whether the program wants it or not. Again, this has the possible advantage of increased reliability because an interrupted change can be fully reverted.
In some filesystems (such as Btrfs or ext4) this is an optional feature; in others (e.g. log-structured filesystems) it is part of the core design.
add a comment |
Could be either – it depends on the text editor that was used.
The concept of a 'text file' isn't built into computers – each operating system may manage files differently, and each text editor may use those files differently.
In practice, you'll find text editors which have both mechanisms. Simple editors such as Notepad usually just ask the OS to write directly into the original file, as that's easiest to implement – but risky if you lose power mid-write. So for reliability reasons, many editors deliberately save the updated data to a new file and delete the original.
(I think in-place updates are more common among hex editors, where most edits don't insert/delete bytes but only change existing locations, so a full rewrite file is not needed.)
There's even a third mode of operation – the editor might first make a backup copy of the old file, then directly write new data into the file.
It also depends on the filesystem which keeps the file. With most traditional filesystems, if a program asks to write to an existing file, the filesystem will just overwrite old data in-place.
However, some filesystems do work in "copy-on-write" mode, where any new data is always written to a different location, whether the program wants it or not. Again, this has the possible advantage of increased reliability because an interrupted change can be fully reverted.
In some filesystems (such as Btrfs or ext4) this is an optional feature; in others (e.g. log-structured filesystems) it is part of the core design.
add a comment |
Could be either – it depends on the text editor that was used.
The concept of a 'text file' isn't built into computers – each operating system may manage files differently, and each text editor may use those files differently.
In practice, you'll find text editors which have both mechanisms. Simple editors such as Notepad usually just ask the OS to write directly into the original file, as that's easiest to implement – but risky if you lose power mid-write. So for reliability reasons, many editors deliberately save the updated data to a new file and delete the original.
(I think in-place updates are more common among hex editors, where most edits don't insert/delete bytes but only change existing locations, so a full rewrite file is not needed.)
There's even a third mode of operation – the editor might first make a backup copy of the old file, then directly write new data into the file.
It also depends on the filesystem which keeps the file. With most traditional filesystems, if a program asks to write to an existing file, the filesystem will just overwrite old data in-place.
However, some filesystems do work in "copy-on-write" mode, where any new data is always written to a different location, whether the program wants it or not. Again, this has the possible advantage of increased reliability because an interrupted change can be fully reverted.
In some filesystems (such as Btrfs or ext4) this is an optional feature; in others (e.g. log-structured filesystems) it is part of the core design.
Could be either – it depends on the text editor that was used.
The concept of a 'text file' isn't built into computers – each operating system may manage files differently, and each text editor may use those files differently.
In practice, you'll find text editors which have both mechanisms. Simple editors such as Notepad usually just ask the OS to write directly into the original file, as that's easiest to implement – but risky if you lose power mid-write. So for reliability reasons, many editors deliberately save the updated data to a new file and delete the original.
(I think in-place updates are more common among hex editors, where most edits don't insert/delete bytes but only change existing locations, so a full rewrite file is not needed.)
There's even a third mode of operation – the editor might first make a backup copy of the old file, then directly write new data into the file.
It also depends on the filesystem which keeps the file. With most traditional filesystems, if a program asks to write to an existing file, the filesystem will just overwrite old data in-place.
However, some filesystems do work in "copy-on-write" mode, where any new data is always written to a different location, whether the program wants it or not. Again, this has the possible advantage of increased reliability because an interrupted change can be fully reverted.
In some filesystems (such as Btrfs or ext4) this is an optional feature; in others (e.g. log-structured filesystems) it is part of the core design.
answered 1 hour ago
grawitygrawity
234k36495551
234k36495551
add a comment |
add a comment |
Chess Man is a new contributor. Be nice, and check out our Code of Conduct.
Chess Man is a new contributor. Be nice, and check out our Code of Conduct.
Chess Man is a new contributor. Be nice, and check out our Code of Conduct.
Chess Man is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1397186%2fwhen-a-pc-edits-file-does-it-delete-original-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown