
-----------------------------------
abzoni
Sun Dec 11, 2005 12:20 pm

paint prog help
-----------------------------------
hi, im currently workin on my paint prog *BIG PROJECT* and im basicly done except i cant get the program to add on a ".bmp" to the end of the filename when the user's saving.  heres what i have so far:
if filename (* -3 .. *) not= ".bmp" then
            filename := filename + ".bmp"
        end if
any help would be appreciated! thx!

-----------------------------------
do_pete
Sun Dec 11, 2005 12:27 pm


-----------------------------------
this is the source code forum not the help forum

-----------------------------------
Paul
Sun Dec 11, 2005 1:53 pm


-----------------------------------
That looks like it would do, what are you having problems with exactly?

-----------------------------------
TheXploder
Sun Dec 11, 2005 7:08 pm


-----------------------------------
shouldn't it be '-4'?

if filename (* -4 .. *) not= ".bmp" then
   filename := filename + ".bmp"
end if


p.s. yay paint I did that for my final project in gr.10

-----------------------------------
we64
Sun Dec 11, 2005 7:16 pm


-----------------------------------
yeah, TheXploder had one of the best paint program around in Turing. Ask him for advice.

-----------------------------------
Paul
Sun Dec 11, 2005 8:15 pm


-----------------------------------
shouldn't it be '-4'?

if filename (* -4 .. *) not= ".bmp" then
   filename := filename + ".bmp"
end if


p.s. yay paint I did that for my final project in gr.10

... no
say the string is "paulbian", "n" would be the 8th letter of the string, getting the last 4 would be *-3, because 8-3=5, and 5..8 is "bian", 4 letters.

-----------------------------------
Paul
Sun Dec 11, 2005 9:03 pm


-----------------------------------
Here's something I put together:

%Saving picture

setscreen ("graphics: 300; 300")

var FileName : string := ""

Draw.Oval (maxx div 2, maxy div 2, 50, 50, brightred)
var PicID := Pic.New (0, 0, maxx, maxy)

cls
put "File name: " ..
get FileName : *

if length (FileName) >= 4 then

    if FileName (* -3 .. *) not= ".bmp" then
        FileName += ".bmp"
    end if

else
    FileName += ".bmp"

end if

Pic.Save (PicID, FileName)



Hope it helps.

-----------------------------------
abzoni
Tue Dec 13, 2005 11:03 am

thx alot!:D
-----------------------------------
i finished my proj w/ your suggestions and ive been told im prolly gonna get perfect.

thx for all your help guys:D
