2014-08-31 186 views
0

使用編寫我的第一個應用程序wxWidgets,編譯的所有東西&運行正常,直到我試圖爲我的應用程序的工具欄加載一些圖像!PNG文件被篡改或沒有足夠的內存

它總是拋出:由ASCII轉換損壞PNG文件 The first screen (only appears in debug configuration) The second screen which shows both errors 我寫了一個簡單的Perl 腳本PNG轉換成可編譯 &一個,然後修改它很多同時通過在線地球儀尋找這個問題的解決方案,其來源如下:

#!/usr/bin/perl 

# Script to convert all PNGs in ./png folder 
# to C/CPP headers for embedding in apkstudio 
# binary. 
# 
# Written by: Vaibhav Pandey <[email protected]> 

# Declaring used namespaces 
use Cwd; 
use File::Basename; 

# Converts the binary file to C/CPP header 
sub Convert { 
    my $png = $_[0]; 
    Print("Converting: ${png}"); 
    # Extract base filename from absolute path 
    $name = File::Basename::basename($png, '.png'); 
    # Clear variables & read png file 
    local $/ = undef; 
    open FILE, "${png}" or die "Cannot read: ${png}\n"; 
    $input = <FILE>; 
    close FILE; 
    # Explode input to unsigned char* 
    @characters = unpack "C*", $input; 
    # Write input to output 
    $namespace = uc $name; 
    print HEADER " static const unsigned char* ${name}_png;\n"; 
    print CPP "static const unsigned char _${name}_png[] = {\n "; 
    foreach $character (@characters) { 
    printf CPP '0x%02x', $character; 
    last if $i == $#characters; 
    print CPP ((++$i % 13) ? ', ' : ",\n "); 
    } 
    print CPP "\n};\n"; 
    print CPP "const unsigned char* Embedded::${name}_png = _${name}_png;\n\n"; 
} 

# Closes the namespace & class enclosure of the source file 
sub FooterCpp { 
    print CPP "} // namespace Embedded\n"; 
    print CPP "} // namespace APKStudio\n"; 
    print CPP "} // namespace VPZ\n\n"; 
} 

# Closes the namespace & class enclosure of the header file 
sub FooterHeader { 
    print HEADER "\n};\n\n"; 
    print HEADER "} // namespace Embedded\n"; 
    print HEADER "} // namespace APKStudio\n"; 
    print HEADER "} // namespace VPZ\n\n"; 
    print HEADER "#endif // VPZ_APKSTUDIO_RESOURCE_EMBEDDED\n"; 
} 

# Write the namespace & class enclosure to the source file 
sub HeaderCpp { 
    print CPP "// Generated by resources.pl. Do not modify.\n"; 
    print CPP "#include \"embedded.h\"\n\n"; 
    print CPP "namespace VPZ {\n"; 
    print CPP "namespace APKStudio {\n"; 
    print CPP "namespace Resource {\n\n"; 
} 

# Write the namespace & class enclosure to the header file 
sub HeaderHeader { 
    print HEADER "// Generated by resources.pl. Do not modify.\n"; 
    print HEADER "#ifndef VPZ_APKSTUDIO_RESOURCE_EMBEDDED\n"; 
    print HEADER "#define VPZ_APKSTUDIO_RESOURCE_EMBEDDED\n\n"; 
    print HEADER "#include <wx/bitmap.h>\n\n"; 
    print HEADER "namespace VPZ {\n"; 
    print HEADER "namespace APKStudio {\n"; 
    print HEADER "namespace Resource {\n\n"; 
    print HEADER "class Embedded {\n\n"; 
    print HEADER "public:\n"; 
} 

# Prints output to console with an EOL auto-appended 
sub Print { 
    my $text = $_[0]; 
    print "${text}\n"; 
} 

# Scans for PNG files recursively in a folder 
sub Scan { 
    my $folder = $_[0]; 
    # Check if is not a folder 
    if (! -d $folder) { 
    Print("Not a folder: ${folder}"); 
    return; 
    } 
    Print("Scanning: ${folder}"); 
    # Try to open folder for scanning 
    opendir DIR, $folder or die $!; 
    # Loop through all the files inside 
    while ($entry = readdir DIR) { 
    # Skip . & .. files 
    next if substr($entry, 0, 1) eq "."; 
    my $path = "${folder}/${entry}"; 
    Print("Found: ${path}"); 
    if (-d $path) { 
     # Scan recursively if found a folder 
     ::Scan($path); 
    } elsif (-f $path) { 
     # Continue if not a PNG file 
     next unless $entry =~ m/\.png$/; 
     # Finally convert if is valid 
     ::Convert($path); 
    } 
    } 
    # Close the opened directory handle 
    closedir(DIR); 
} 

# Get current working directory 
$wd = Cwd::getcwd(); 
# Compute absolute path for C/CPP header 
my $header = "${wd}/embedded.h"; 
my $cpp = "${wd}/embedded.cpp"; 
# Open output stream for writing 
open HEADER, ">${header}" or die "Cannot write: ${header}\n"; 
open CPP, ">${cpp}" or die "Cannot write: ${cpp}\n"; 
HeaderHeader(HEADER); 
HeaderCpp(CPP); 
# Fires up the whole thing 
::Scan("${wd}/png"); 
# Close the already open header file 
FooterHeader(HEADER); 
FooterCpp(CPP); 
close CPP; 
close HEADER; 

對我來說,這似乎已經閱讀了PNG文本,而不是二進制模式(我還不確定,因爲我從來沒有處理任何的PerlwxWidgets的,這是我的第二C++應用曾經)!

我也嘗試過官方(它看起來像網站上的特色)Perl腳本here,但它是一樣的。另外,我通過這兩個腳本驗證輸出的數組元素,礦&的似乎要被官方之一,並且是相同的,如下所示:

static const unsigned char _android_png[] = { 
    0x89, 0x50, 0x4e, 0x47, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 
    0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 
    0x00, 0x00, 0x1f, 0xf3, 0xff, 0x61, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 
    0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, 0x64, 0x6f, 
    0x62, 0x65, 0x20, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61, 0x64, 0x79, 
    0x71, 0xc9, 0x65, 0x3c, 0x00, 0x00, 0x03, 0x69, 0x69, 0x54, 0x58, 0x74, 0x58, 
    0x4d, 0x4c, 0x3a, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 
    0x78, 0x6d, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3f, 0x78, 0x70, 0x61, 
    0x63, 0x6b, 0x65, 0x74, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x3d, 0x22, 0xef, 
    0xbb, 0xbf, 0x22, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x57, 0x35, 0x4d, 0x30, 0x4d, 
    0x70, 0x43, 0x65, 0x68, 0x69, 0x48, 0x7a, 0x72, 0x65, 0x53, 0x7a, 0x4e, 0x54, 
    0x63, 0x7a, 0x6b, 0x63, 0x39, 0x64, 0x22, 0x3f, 0x3e, 0x20, 0x3c, 0x78, 0x3a, 
    0x78, 0x6d, 0x70, 0x6d, 0x65, 0x74, 0x61, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 
    0x3a, 0x78, 0x3d, 0x22, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x3a, 0x6e, 0x73, 0x3a, 
    0x6d, 0x65, 0x74, 0x61, 0x2f, 0x22, 0x20, 0x78, 0x3a, 0x78, 0x6d, 0x70, 0x74, 
    0x6b, 0x3d, 0x22, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x58, 0x4d, 0x50, 0x20, 
    0x43, 0x6f, 0x72, 0x65, 0x20, 0x35, 0x2e, 0x30, 0x2d, 0x63, 0x30, 0x36, 0x30, 
    0x20, 0x36, 0x31, 0x2e, 0x31, 0x33, 0x34, 0x37, 0x37, 0x37, 0x2c, 0x20, 0x32, 
    0x30, 0x31, 0x30, 0x2f, 0x30, 0x32, 0x2f, 0x31, 0x32, 0x2d, 0x31, 0x37, 0x3a, 
    0x33, 0x32, 0x3a, 0x30, 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 
    0x22, 0x3e, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x52, 0x44, 0x46, 0x20, 0x78, 
    0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x72, 0x64, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 
    0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, 
    0x67, 0x2f, 0x31, 0x39, 0x39, 0x39, 0x2f, 0x30, 0x32, 0x2f, 0x32, 0x32, 0x2d, 
    0x72, 0x64, 0x66, 0x2d, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x2d, 0x6e, 0x73, 
    0x23, 0x22, 0x3e, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63, 
    0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x72, 0x64, 0x66, 0x3a, 0x61, 
    0x62, 0x6f, 0x75, 0x74, 0x3d, 0x22, 0x22, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 
    0x3a, 0x78, 0x6d, 0x70, 0x52, 0x69, 0x67, 0x68, 0x74, 0x73, 0x3d, 0x22, 0x68, 
    0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 
    0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61, 0x70, 0x2f, 0x31, 0x2e, 0x30, 
    0x2f, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x2f, 0x22, 0x20, 0x78, 0x6d, 0x6c, 
    0x6e, 0x73, 0x3a, 0x78, 0x6d, 0x70, 0x4d, 0x4d, 0x3d, 0x22, 0x68, 0x74, 0x74, 
    0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 
    0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61, 0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x6d, 
    0x6d, 0x2f, 0x22, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x73, 0x74, 0x52, 
    0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 
    0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61, 
    0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x73, 0x54, 0x79, 0x70, 0x65, 0x2f, 0x52, 
    0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x66, 0x23, 0x22, 0x20, 
    0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x78, 0x6d, 0x70, 0x3d, 0x22, 0x68, 0x74, 
    0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 
    0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61, 0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 
    0x22, 0x20, 0x78, 0x6d, 0x70, 0x52, 0x69, 0x67, 0x68, 0x74, 0x73, 0x3a, 0x4d, 
    0x61, 0x72, 0x6b, 0x65, 0x64, 0x3d, 0x22, 0x46, 0x61, 0x6c, 0x73, 0x65, 0x22, 
    0x20, 0x78, 0x6d, 0x70, 0x4d, 0x4d, 0x3a, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 
    0x6e, 0x74, 0x49, 0x44, 0x3d, 0x22, 0x78, 0x6d, 0x70, 0x2e, 0x64, 0x69, 0x64, 
    0x3a, 0x39, 0x41, 0x31, 0x42, 0x43, 0x43, 0x37, 0x43, 0x38, 0x42, 0x31, 0x46, 
    0x31, 0x31, 0x45, 0x30, 0x41, 0x42, 0x35, 0x33, 0x44, 0x38, 0x45, 0x42, 0x33, 
    0x45, 0x33, 0x43, 0x42, 0x38, 0x34, 0x31, 0x22, 0x20, 0x78, 0x6d, 0x70, 0x4d, 
    0x4d, 0x3a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x3d, 
    0x22, 0x78, 0x6d, 0x70, 0x2e, 0x69, 0x69, 0x64, 0x3a, 0x39, 0x41, 0x31, 0x42, 
    0x43, 0x43, 0x37, 0x42, 0x38, 0x42, 0x31, 0x46, 0x31, 0x31, 0x45, 0x30, 0x41, 
    0x42, 0x35, 0x33, 0x44, 0x38, 0x45, 0x42, 0x33, 0x45, 0x33, 0x43, 0x42, 0x38, 
    0x34, 0x31, 0x22, 0x20, 0x78, 0x6d, 0x70, 0x3a, 0x43, 0x72, 0x65, 0x61, 0x74, 
    0x6f, 0x72, 0x54, 0x6f, 0x6f, 0x6c, 0x3d, 0x22, 0x41, 0x64, 0x6f, 0x62, 0x65, 
    0x20, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x20, 0x43, 0x53, 
    0x33, 0x20, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x22, 0x3e, 0x20, 0x3c, 
    0x78, 0x6d, 0x70, 0x4d, 0x4d, 0x3a, 0x44, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 
    0x46, 0x72, 0x6f, 0x6d, 0x20, 0x73, 0x74, 0x52, 0x65, 0x66, 0x3a, 0x69, 0x6e, 
    0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x3d, 0x22, 0x75, 0x75, 0x69, 
    0x64, 0x3a, 0x41, 0x43, 0x31, 0x46, 0x32, 0x45, 0x38, 0x33, 0x33, 0x32, 0x34, 
    0x41, 0x44, 0x46, 0x31, 0x31, 0x41, 0x41, 0x42, 0x38, 0x43, 0x35, 0x33, 0x39, 
    0x30, 0x44, 0x38, 0x35, 0x42, 0x35, 0x42, 0x33, 0x22, 0x20, 0x73, 0x74, 0x52, 
    0x65, 0x66, 0x3a, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x44, 
    0x3d, 0x22, 0x75, 0x75, 0x69, 0x64, 0x3a, 0x43, 0x39, 0x44, 0x33, 0x34, 0x39, 
    0x36, 0x36, 0x34, 0x41, 0x33, 0x43, 0x44, 0x44, 0x31, 0x31, 0x42, 0x30, 0x38, 
    0x41, 0x42, 0x42, 0x42, 0x43, 0x46, 0x46, 0x31, 0x37, 0x32, 0x31, 0x35, 0x36, 
    0x22, 0x2f, 0x3e, 0x20, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 
    0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x20, 0x3c, 0x2f, 0x72, 
    0x64, 0x66, 0x3a, 0x52, 0x44, 0x46, 0x3e, 0x20, 0x3c, 0x2f, 0x78, 0x3a, 0x78, 
    0x6d, 0x70, 0x6d, 0x65, 0x74, 0x61, 0x3e, 0x20, 0x3c, 0x3f, 0x78, 0x70, 0x61, 
    0x63, 0x6b, 0x65, 0x74, 0x20, 0x65, 0x6e, 0x64, 0x3d, 0x22, 0x72, 0x22, 0x3f, 
    0x3e, 0x27, 0x66, 0xfb, 0x9f, 0x00, 0x00, 0x02, 0xcb, 0x49, 0x44, 0x41, 0x54, 
    0x78, 0xda, 0x8c, 0x52, 0x4b, 0x4f, 0x13, 0x51, 0x14, 0xfe, 0x66, 0x7a, 0xfb, 
    0x18, 0x68, 0xa7, 0xbc, 0x8a, 0x50, 0x25, 0x22, 0xc6, 0x18, 0x94, 0x44, 0x08, 
    0x24, 0x36, 0x69, 0xdc, 0xb8, 0x81, 0x44, 0xc5, 0xe8, 0xa2, 0x0b, 0x13, 0x49, 
    0x64, 0xc1, 0xca, 0x3f, 0x20, 0xee, 0x8d, 0x2b, 0x37, 0xee, 0xba, 0xc0, 0x84, 
    0xc4, 0x18, 0xd8, 0x68, 0x84, 0x10, 0x1b, 0x34, 0x71, 0x25, 0x4d, 0x28, 0x62, 
    0x0d, 0xc5, 0xf2, 0x12, 0x79, 0x95, 0x47, 0x4b, 0x81, 0x29, 0xd3, 0x96, 0xf6, 
    0xb6, 0xe3, 0x99, 0xb6, 0x20, 0x89, 0x0b, 0xbd, 0x93, 0x93, 0x7b, 0xce, 0x9c, 
    0xef, 0x7c, 0xf7, 0x9c, 0x2f, 0x47, 0xc0, 0x90, 0x03, 0xa5, 0x13, 0x40, 0x5e, 
    0xeb, 0x06, 0xcf, 0x47, 0x60, 0x10, 0xf0, 0xd7, 0xc9, 0x69, 0x00, 0x13, 0x9d, 
    0x10, 0x85, 0xf7, 0x14, 0x75, 0xe8, 0xbf, 0x34, 0xcf, 0x0e, 0x18, 0x34, 0xad, 
    0x08, 0xd0, 0xd0, 0x4d, 0x04, 0x7a, 0xb2, 0x9f, 0xfc, 0x3b, 0x74, 0x5f, 0x21, 
    0xb3, 0x91, 0x25, 0xc8, 0x66, 0xc9, 0x46, 0x28, 0xff, 0x8c, 0xee, 0x6e, 0x9c, 
    0xe2, 0x67, 0xd8, 0x4d, 0x15, 0x3d, 0x51, 0x88, 0xc0, 0x64, 0x78, 0x23, 0x5b, 
    0xed, 0xcf, 0x3b, 0x9a, 0x3b, 0xce, 0x9f, 0xad, 0x39, 0x27, 0x1b, 0x99, 0x91, 
    0x65, 0xb2, 0x19, 0xbe, 0x1e, 0x5b, 0x6f, 0xfd, 0x1a, 0x0e, 0xb8, 0x95, 0x43, 
    0xe5, 0x35, 0x32, 0xb9, 0x08, 0x11, 0x9d, 0x10, 0x88, 0x27, 0x9e, 0x86, 0x9b, 
    0x95, 0x16, 0xb9, 0xe7, 0x46, 0xb3, 0xbb, 0x65, 0x77, 0x71, 0xa3, 0x6a, 0x63, 
    0xf9, 0x17, 0x8b, 0xc7, 0xe3, 0x58, 0x59, 0x5a, 0x62, 0xd1, 0xc5, 0xb5, 0x2a, 
    0x22, 0x6d, 0xb1, 0x59, 0xca, 0x7b, 0x74, 0xdc, 0xe9, 0xc9, 0x44, 0x58, 0x18, 
    0x90, 0xcd, 0x01, 0x19, 0xfe, 0xc8, 0x75, 0xcd, 0xdd, 0xb8, 0x1c, 0x9e, 0x37, 
    0x7e, 0xbb, 0xe7, 0xc7, 0xf4, 0x97, 0x09, 0x6c, 0x45, 0xb6, 0x10, 0x9c, 0xf0, 
    0x63, 0xe6, 0xfe, 0x24, 0xe6, 0x7f, 0xcc, 0x18, 0x2f, 0xb4, 0x5c, 0x6c, 0xd4, 
    0x71, 0x05, 0xbc, 0x5e, 0x57, 0x18, 0xc1, 0x6a, 0x02, 0x8c, 0xd4, 0xc8, 0x66, 
    0xa2, 0xa9, 0x52, 0xae, 0xb6, 0x2a, 0x67, 0x14, 0x3c, 0xfe, 0xfe, 0x04, 0x35, 
    0x0d, 0x0d, 0xd8, 0xde, 0xde, 0x86, 0xb9, 0xc6, 0x0e, 0xcf, 0x64, 0x2f, 0x72, 
    0xb5, 0x06, 0xa4, 0x6d, 0x19, 0x2b, 0x8e, 0x78, 0x13, 0xea, 0x49, 0x1a, 0xf3, 
    0x31, 0x81, 0x86, 0x3e, 0x0a, 0xfa, 0x90, 0xc9, 0x23, 0x14, 0x0a, 0x89, 0xb1, 
    0x58, 0x0c, 0xb3, 0xe1, 0x30, 0x32, 0xaa, 0x0a, 0x35, 0x1a, 0x85, 0x89, 0x31, 
    0x7c, 0x3a, 0x18, 0x83, 0x5c, 0x5d, 0x0d, 0x73, 0x82, 0x89, 0x84, 0x33, 0x13, 
    0x3e, 0x40, 0x75, 0x5e, 0xaa, 0xf7, 0x0a, 0x18, 0xac, 0x0c, 0xf4, 0x76, 0xf5, 
    0xb6, 0x07, 0x83, 0x41, 0xb4, 0xb5, 0xb6, 0x21, 0x15, 0x4f, 0xc2, 0x94, 0x65, 
    0x64, 0x46, 0xa8, 0x8a, 0x8a, 0xb4, 0x90, 0x46, 0x42, 0x3a, 0xc4, 0xbe, 0x4d, 
    0x81, 0x22, 0x27, 0x50, 0x16, 0x2a, 0x43, 0xf4, 0x6a, 0x14, 0xab, 0x1f, 0x57, 
    0xa7, 0xb4, 0x87, 0xf1, 0x0e, 0x86, 0x64, 0x16, 0x9c, 0xf3, 0x42, 0x3b, 0xc9, 
    0x54, 0x12, 0x6b, 0xb1, 0x35, 0x24, 0x93, 0x49, 0xa4, 0xd4, 0x14, 0xa2, 0xd4, 
    0x01, 0x67, 0x94, 0xab, 0xa4, 0x64, 0x35, 0x20, 0x19, 0x25, 0x94, 0xd1, 0xc7, 
    0x73, 0xf4, 0x8f, 0xea, 0x8a, 0x22, 0x96, 0x9c, 0xbd, 0xbd, 0x3d, 0xfc, 0xcf, 
    0x39, 0xc1, 0x95, 0xea, 0x18, 0xd2, 0xdc, 0x3b, 0xf8, 0xea, 0x65, 0x9f, 0x1e, 
    0xb8, 0x5c, 0xae, 0xf6, 0x7f, 0x11, 0xfc, 0x5c, 0x98, 0x9e, 0xc2, 0x02, 0x39, 
    0x82, 0xe0, 0x2d, 0x89, 0xa8, 0x79, 0x49, 0x29, 0x2f, 0xea, 0x6c, 0xfe, 0xe8, 
    0xee, 0xb6, 0x22, 0x49, 0x92, 0xac, 0xe9, 0xdb, 0x99, 0xa7, 0x96, 0x25, 0xa9, 
    0x38, 0x82, 0x85, 0x90, 0x12, 0xc0, 0xe3, 0xd9, 0x03, 0x38, 0x2b, 0x38, 0xa2, 
    0x87, 0x2e, 0x64, 0x79, 0xa9, 0x03, 0xfd, 0xd8, 0xca, 0x81, 0x7d, 0xee, 0x1d, 
    0x7f, 0x37, 0xe2, 0x81, 0x9a, 0xc1, 0x65, 0xf7, 0xf5, 0xce, 0xb9, 0x31, 0xbf, 
    0x0f, 0x07, 0x3a, 0x42, 0x44, 0xed, 0xdd, 0x4b, 0x9d, 0x3b, 0xbe, 0x15, 0x1f, 
    0x64, 0x03, 0xe9, 0xc1, 0x86, 0x51, 0x5e, 0x46, 0x78, 0xa5, 0x44, 0xf0, 0x34, 
    0xaf, 0x4f, 0x06, 0x74, 0x99, 0x07, 0x20, 0xf3, 0x01, 0xd8, 0xb5, 0x51, 0x87, 
    0xc3, 0x81, 0xb9, 0x34, 0x38, 0xed, 0xfc, 0x6d, 0x5a, 0xdb, 0x51, 0x66, 0xa7, 
    0x77, 0x14, 0x9e, 0xc3, 0x46, 0xfe, 0x16, 0x0e, 0xe8, 0x65, 0xdf, 0x51, 0x71, 
    0x9e, 0xfe, 0xe3, 0x0e, 0x40, 0xd2, 0x7e, 0x38, 0x92, 0x0b, 0xa2, 0x3e, 0x40, 
    0x05, 0x63, 0xfa, 0x76, 0xa2, 0x02, 0x43, 0x70, 0xc2, 0xa3, 0x15, 0xe3, 0x54, 
    0xde, 0x8e, 0x61, 0xee, 0x2c, 0x2c, 0x3d, 0xd1, 0x91, 0xa9, 0x7f, 0x46, 0xd0, 
    0x09, 0x80, 0x3a, 0x32, 0x03, 0xd6, 0x30, 0xfe, 0xf9, 0xc5, 0x5b, 0x1b, 0x22, 
    0x18, 0xa7, 0xb8, 0x5e, 0xbf, 0x57, 0xbd, 0x41, 0x1b, 0x36, 0x85, 0x62, 0x5c, 
    0x50, 0x07, 0xb9, 0x63, 0x82, 0xdf, 0x02, 0x0c, 0x00, 0xbc, 0x10, 0x2e, 0x3f, 
    0x7d, 0xcf, 0x4d, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 
    0x42, 0x60, 0x82 
}; 

其中它引發錯誤的代碼只是一個簡單的塊如在網站上提到的幾行:

wxMemoryInputStream inStream(Resource::Embedded::android_png, sizeof(Resource::Embedded::android_png)); 
wxBitmap image(wxImage(inStream, wxBITMAP_TYPE_PNG)); 

而且,如果它可以幫助...我正在的Perl特別是5.18.2.1802版在64位的ActiveState的的分佈AMD機器ne與Windows 8.1。我對ActiveState Perl的文件處理實現有強烈的疑問,但如果任何人有時間來幫助我的話,嚴格需要專家的建議。我會很感激。

+0

只給了嘗試官方C&Pythong版本的幫手腳本沒有成功。所有輸出相同的字節數組不起作用。現在我開始懷疑我的形象:P – 2014-08-31 10:53:35

回答

0

問題解決了!問題在於CPP代碼,特別是在成員變量初始化中。很抱歉打擾!

1

在Perl腳本中使用三參數打開。然後,您可以添加:raw圖層:

open FILE, '<:raw', $png or die "Cannot read: ${png}: $!\n"; 
相關問題