"Plik w pliku"
Ostatnio zmodyfikowano 2009-10-15 15:58
Thud |
» 2009-10-13 20:01:36 1.cpp:2:19: error: conio.h: No such file or directory 1.cpp:3:21: error: fstream.h: No such file or directory 1.cpp: In function ‘int main()’: 1.cpp:9: error: ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’ was not declared in this scope 1.cpp:17: error: ‘ofstream’ was not declared in this scope 1.cpp:17: error: expected `;' before ‘plik’ 1.cpp:18: error: ‘plik’ was not declared in this scope 1.cpp:24: error: ‘system’ was not declared in this scope |
|
Elaine |
» 2009-10-13 20:01:38 Zapisz binarnie: plik.write( reinterpret_cast < const char *>( file ), 1310 ); Mała rada - zrób tę tablicę zmienną (a najlepiej stałą) globalną (ew. statyczną) - w obecnej postaci jest wypełniana przy starcie programu... |
|
Thud |
» 2009-10-13 20:04:25 <<removed by user>> Napisałem głupoty. :P |
|
franz Temat założony przez niniejszego użytkownika |
» 2009-10-13 20:54:04
fstream plik; plik.open("plik.jpeg",ios::out); plik.write(reinterpret_cast<const char*>(file), 1310); plik.close();
Mam coś takiego tylko wypluwa błędy.Nie zamianiłem tego z zmienną/stałą typu global bo nie potrafie... |
|
Elaine |
» 2009-10-13 22:06:01 Można wiedzieć, jakie błędy? Bez tego niewiele można pomóc. |
|
franz Temat założony przez niniejszego użytkownika |
» 2009-10-13 22:18:41 Oczywiście
Kompilator: Default compiler Wykonywanie g++.exe... g++.exe "C:\Documents and Settings\user\Moje dokumenty\Ściepki z C++\de.cpp" -o "C:\Documents and Settings\user\Moje dokumenty\Ściepki z C++\de.exe" -g3 -I"D:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"D:\Dev-Cpp\include\c++\3.4.2\backward" -I"D:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"D:\Dev-Cpp\include\c++\3.4.2" -I"D:\Dev-Cpp\include" -L"D:\Dev-Cpp\lib" -g3 In file included from D:/Dev-Cpp/include/c++/3.4.2/backward/fstream.h:31, from C:\Documents and Settings\user\Moje dokumenty\Ściepki z C++\de.cpp:3: D:/Dev-Cpp/include/c++/3.4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated. C:\Documents and Settings\user\Moje dokumenty\Ściepki z C++\de.cpp: In function `int main()': C:\Documents and Settings\user\Moje dokumenty\Ściepki z C++\de.cpp:20: error: `ios' has not been declared C:\Documents and Settings\user\Moje dokumenty\Ściepki z C++\de.cpp:20: error: `out' undeclared (first use this function) C:\Documents and Settings\user\Moje dokumenty\Ściepki z C++\de.cpp:20: error: (Each undeclared identifier is reported only once for each function it appears in.)
Wykonanie zakończone
|
|
Elaine |
» 2009-10-14 08:23:51 fstream.h nie istnieje, tylko starsze kompilatory go dorzucają, użyj fstream. #include <fstream>
const unsigned char file[ 1310 ] = { }; int main() { std::ofstream plik( "foo.jpg", std::ios::out | std::ios::binary ); plik.write( reinterpret_cast < const char *>( file ), sizeof file ); } Powinno działać. EDIT: Tool miał pewnego buga, wypadałoby zassać jeszcze raz (link ten sam). |
|
franz Temat założony przez niniejszego użytkownika |
» 2009-10-14 20:53:39 Elo,program działa pliki sie wypakowują,dziękuje bardzo Jeszcze tylko jeden mały problem. Mianowicie,gdy na końcu kodu napisze system("obojetnie_jaki_plik_do_otworzenia");
to w konsoli pisze,że program nie może być wyłączony,bo jest aktua;lnie używany-czy jakoś pod ten klimat. Wiesz jak temu zapobiec? |
|
1 2 « 3 » 4 |