Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Having problems downloading pictures of the net
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Homer_simpson




PostPosted: Sat Apr 19, 2003 2:17 am   Post subject: Having problems downloading pictures of the net

code:
var url : string
url := "http://www.geocities.com/stmxpm/finaly.jpg"
var netStream : int
var f : int
var ch : char
netStream := Net.OpenURLConnection (url)

open : f, "c:/downloaded file.jpg", write
loop
    exit when eof (netStream)
    get : netStream, ch
    write : f, ch
    %put ch
end loop
Net.CloseConnection (netStream)
close (f)
ok that's the code and it's supposed to download a jpg file off this address "http://www.geocities.com/stmxpm/finaly.jpg". well .... it downloads somethink and it's a picture but when i open it it's a whole new picture.
Sponsor
Sponsor
Sponsor
sponsor
Homer_simpson




PostPosted: Sat Apr 19, 2003 2:21 am   Post subject: (No subject)

when i use the program download bmp files it seems to work fine but it has a problem with all jpgs.
code:
var url : string
url := "http://www.geocities.com/stmxpm/sc1.bmp"

var netStream : int
var ch : char

netStream := Net.OpenURLConnection (url)
if netStream <= 0 then
    put "Unable to connect to ", url
    return
end if
var f : int
open : f, "c:/downloaded file.bmp", write
loop
    exit when eof (netStream)
    get : netStream, ch
    write : f, ch
    %put ch
end loop
Net.CloseConnection (netStream)
close (f)

anybody knows how to solve the problem?[/code]
jamez




PostPosted: Sat Apr 19, 2003 7:25 am   Post subject: (No subject)

I made it able to download JPGs but it really screws up the pic.

code:
var location : string := ""
put "http://" ..
get location
location := "HTTP://" + location

var ch : char
var netStream : int := Net.OpenURLConnection (location)

if netStream <= 0 then
    put "Image does not exist."
    return
end if

put "Saving..."

var file : int
open : file, "C:/DownloadedImage." + location (length (location) - 2 .. length (location)), write
loop
    exit when eof (netStream)
    get : netStream, ch
    write : file, ch
end loop
Net.CloseConnection (netStream)
close (file)

locate (2, 1)
put "Image saved."
Blade




PostPosted: Sat Apr 19, 2003 9:36 am   Post subject: (No subject)

well... i dunno if any of you guys ever had this problem, but when i was making a game, i could NOT use jpg's... i always had errors no matter what i did with it...but was fine with bmp's... could be a flaw in turing...
Catalyst




PostPosted: Sat Apr 19, 2003 11:12 am   Post subject: (No subject)

jpgs are only in 4.0x they wont work if u use 3.11
Blade




PostPosted: Sat Apr 19, 2003 12:04 pm   Post subject: (No subject)

i use 4.0.4c
Homer_simpson




PostPosted: Sat Apr 19, 2003 12:45 pm   Post subject: (No subject)

that's exactly my problem too i can download bmps but when i download jpgs they get screwed up Confused =/
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: