Cody

# Problem 699. Reading Web Binary Files (jpg,pdf,tiff,png)

Solution 188005

Submitted on 8 Jan 2013 by Tomasz
• Size: 8
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% % Cody External accessibility % This file may need to change in the future in_f='http://www.pvplc.org/_volunteer/docs/PVPLC%20Trail%20Crew%20Training%20Jan-Jun%202012.pdf'; out_f='PVPLC.pdf'; urlwrite(in_f,out_f); fid=fopen(out_f); urlwrite_out=fread(fid,128,'*uint8'); % Display Correct Binary Data urlwrite_out(1:16)' block=urlread(in_f); % Display invalid binary data urlread_out=block(1:16)-char(0) % unicode urlread conversion affects bytes 12 thru 15 n=12 byte_val = access_web_pdf(in_f,n) byte_correct=181; assert(isequal(byte_val,byte_correct))

ans = 37 80 68 70 45 49 46 53 13 10 37 181 181 181 181 13 urlread_out = Columns 1 through 8 37 80 68 70 45 49 46 53 Columns 9 through 16 13 10 37 65533 65533 65533 65533 13 n = 12 ans = 181 byte_val = 181