As I initially suspected, .K: refers to a partition, not the disk.
Below is a test I run to confirm.
Sector content after formatting a USB flash disk.
* dd if=/dev/sdd bs=512 count=1 ... (On Linux)
C:UsersshinjDocumentssrcmultibootusb.adhoc>file after_format_mbr.bs
after_format_mbr.bs: DOS/MBR boot sector MS-MBR Windows 7 english at offset 0x163 "Invalid partition table" at offset 0x17b "Error loading operating system" at offset 0x19a "Missing operating system", disk signature 0x86b8be15; partition 1 : ID=0xc, start-CHS (0x0,2,3), end-CHS (0x1f0,254,63), startsector 128, 7986944 sectors
* dd if=/dev/sdd1 bs=512 count=1 ... (On Linux)
C:UsersshinjDocumentssrcmultibootusb.adhoc>file after_format_p1.bs
after_format_p1.bs: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "MSDOS5.0", sectors/cluster 8, reserved sectors 816, Media descriptor 0xf8, sectors/track 63, heads 255, hidden sectors 128, sectors 7986944 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 7784, reserved 0x1, serial number 0xdc67e9d7, unlabeled
* dd if=\.K: bs=512 count=1 ... (On Windows)
C:UsersshinjDocumentssrcmultibootusb.adhoc>file after_format_k.bs
after_format_k.bs: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "MSDOS5.0", sectors/cluster 8, reserved sectors 816, Media descriptor 0xf8, sectors/track 63, heads 255, hidden sectors 128, sectors 7986944 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 7784, serial number 0xdc67e9d7, unlabeled
So if=/dev/sdd1 and if=.k: seems to read the same sector.
Sector content after writing a iso image to .k
* dd if=/dev/sdd bs=512 count=1 ... (On Linux)
C:UsersshinjDocumentssrcmultibootusb.adhoc>file after_dd_mbr.bs
after_dd_mbr.bs: DOS/MBR boot sector MS-MBR Windows 7 english at offset 0x163 "Invalid partition table" at offset 0x17b "Error loading operating system" at offset 0x19a "Missing operating system", disk signature 0x86b8be15; partition 1 : ID=0xc, start-CHS (0x0,2,3), end-CHS (0x1f0,254,63), startsector 128, 7986944 sectors
* dd if=/dev/sdd1 bs=512 count=1 ... (On Linux)
C:UsersshinjDocumentssrcmultibootusb.adhoc>file after_dd_p1.bs
after_dd_p1.bs: DOS/MBR boot sector; partition 2 : ID=0xef, start-CHS (0x3ff,254,63), end-CHS (0x3ff,254,63), startsector 328, 6688 sectors
* dd if=\.K: bs=512 count=1 ... (On Windows)
C:UsersshinjDocumentssrcmultibootusb.adhoc>file after_dd_k.bs
after_dd_k.bs: DOS/MBR boot sector; partition 2 : ID=0xef, start-CHS (0x3ff,254,63), end-CHS (0x3ff,254,63), startsector 328, 6688 sectors
So MBR remains unchanged and the first sector of the partition get updated. if=/dev/sdd1 and if=.K: still generates same content.
After dding iso image to /dev/sdd using mbusb on LInux
* dd if=/dev/sdd bs=512 count=1 ... (On Linux)
C:UsersshinjDocumentssrcmultibootusb.adhoc>file after_dd_sdc_mbr.bs
after_dd_sdc_mbr.bs: DOS/MBR boot sector; partition 2 : ID=0xef, start-CHS (0x3ff,254,63), end-CHS (0x3ff,254,63), startsector 328, 6688 sectors
Now MBR gets update and seems to match the first sector of the partition before dding onto /dev/sdd.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
#include <iostream> #include <conio.h> #include <string.h> #include <iomanip> using namespace std; FILE *fl; typedef struct { char fio[40]; int num; char doljn[5]; int god; } Info; Info ms[100]; int n = 0, i, j; char fname[20]; int menu(); void nnf(); void newf(); void spisok(); void opf(); void resc(); void resf(); int main() { while (true) { switch (menu()) { case 1: nnf(); break; case 2: newf(); break; case 3: spisok(); break; case 4: opf(); break; ///redact case 5: resc(); break; case 6: resf(); break; case 7: return 0; default: "Viberite pravilno!"; } puts("Press any key to continue"); getch(); system("cls"); } } int menu() { cout << "VIBERITE:" << endl; cout << "1. Vvod file name" << endl; cout << "2. New file" << endl; cout << "3. Vvesti spisok" << endl; cout << "4. Open file" << endl; cout << "5. Vivesti result" << endl; cout << "6. Vivesti v fail" << endl; cout << "7. Exit" << endl; int i; cin >> i; return i; } void nnf() { cout << "Vvedite file name" << endl; cin >> fname; } void newf() { if ((fl = fopen(fname, "wb")) == NULL) { cout << "Oshibka pri sozdanii" << endl; exit(1); } cout << "OK" << endl; fclose(fl); } void spisok() { if ((fl = fopen(fname, "rb+")) == NULL) { cout << "Oshibka pri sozdanii" << endl; exit(1); } cout << "Vvedite chislo sotrudnikov: "; cin >> n; for (int i = 0; i<n; i++) { cout << "Vvedite fio sotrudnika: "; cin >> ms[i].fio; cout << "Vvedite nomer otdela: "; cin >> ms[i].num; cout << "Vvedite doljnost': "; cin >> ms[i].doljn; cout << "Vvedite god nachala raboty: "; cin >> ms[i].god; fwrite(&ms[i], sizeof(Info), 1, fl); cout << endl; } fclose(fl); } void opf() { if ((fl = fopen(fname, "rb")) == NULL) { cout << "Oshibka pri otkritii" << endl; exit(1); } n = 0; Info t; cout << "Spisok:" << endl; while (true) { int nwrt = fread(&t, sizeof(Info), 1, fl); if (nwrt != 1) break; ms[n] = t; cout << ms[n].fio << ", " << ms[n].num << ", " << ms[n].doljn << ", " << ms[n].god << endl; n++; } fclose(fl); } void resc() { int d; cout << "Vvedite tekushii god: "; cin >> d; cout << endl << "Sotrudniki, proraboravshie 20 let:" << endl; cout << endl; for (int i = 0; i<n; i++) if ((d - ms[i].god) >= 20) cout << ms[i].fio << ", " << ms[i].num << ", " << ms[i].doljn << ", " << ms[i].god << endl; } void resf() { char codet[30], cd[30], s[30]; FILE *ft; cout << "Vvedite imya faila: " << endl; cin >> codet; if ((ft = fopen(codet, "w")) == NULL) { cout << "Oshibka pri sozdanii!" << endl; exit(1); } int d; cout << "Vvedite tekushuyu datu: "; cin >> d; for (int i = 0; i < n; i++) if ((d - ms[i].god) >= 20) { strcpy(s, ms[i].fio); strcat(s, "n"); fputs(s, ft); itoa(ms[i].god, cd, 10); strcpy(s, cd); strcat(s, "n"); fputs(s, ft); } fclose(ft); } |
-
Печать
-
FAQ
-
Общие
-
Пользователи
-
Пользовательское ПО
- Ошибка при установке драйвера принтера HP: Cannot Open Output File
-
Для открытия ссылки в следующем сообщении/заметке необходимо нажать и удерживать клавишу Ctrl или Cmd или Shift и кликнуть по ссылке (зависит от вашего браузера и ОС).
-
Симптомы:
-
Проблема:
-
Решение:
-
Информация FAQ
- Номер статьи: 160089
- Категория: Общие::Пользователи::Пользовательское ПО
-
Ключевые слова:
ошибка
Cannot
Open
Output
File
установка
принтер
драйвер
HP
- Состояние: общедоступное (всем)
- Язык: ru
-
Оценка:
0 из 5
- Голоса: 0
Topic: can not open output file (Read 5710 times)
Hello everyone. I am rather new to programming.
I have been using learncpp.com to learn coding, and downloaded the code::blocks IDE.
Everything was going fine until I was learning to debug. I was learning about the call stack and ran a code segment provided by the
site. All was fine and dandy until I erased the code and attempted to run another segment. I turned off the debugger and pasted the
new code and when I attempted to build I ran into an error.
In the build messages in the log window, under file it is 1d.exe, and the error associated was
cannot open output file bindebugtestcode.exe Permission denied
error: 1d returned 1 exit status.
In the build log it stated
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file binDebugTestCode.exe: Permission denied
collect2.exe: error: ld returned 1 exit status
What did I do?
I can not even erase the file to begin again because it is stating a file is in use by another program
Logged
Open task manager and search for it or look for gdb.exe. When you find it, just kill the app and try to build again.
Logged
(most of the time I ignore long posts)
[strangers don’t send me private messages, I’ll ignore them; post a topic in the forum, but first read the rules!]
What version of codeblocks are you using?
Try a nightly if this error keeps popping up…
Logged
@oBFusCATed
thank you, that did the trick. I lost that one project because I missed your reply. I ran into the same issue with another debugging and
your suggestion resolved the issue. Thank you for your time.
@BlueHazzard
17.12
Thank you for helping.
Logged
Can you try to find a way to reproduce the problem reliably?
Logged
(most of the time I ignore long posts)
[strangers don’t send me private messages, I’ll ignore them; post a topic in the forum, but first read the rules!]