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

Username:   Password: 
 RegisterRegister   
 writing to a file probleml, HELP NEEDED
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
hey_joe42




PostPosted: Mon Mar 10, 2003 5:54 pm   Post subject: writing to a file probleml, HELP NEEDED

im going to post this msg twice because i really need an answer on this question
okay i solved the original reading problem i was having( you can see for yourself how i did so) but now i can't figure out the writing to a file part,
Plz try out the program yourself cuz the problem probably lies somewhere else, thank you for your time!
here is my code for writing to the file:
var font1:int
font1 := Font.New ("serif:12")
loop
if buttonmoved ("down") then
buttonwait ("down", mx, my, mbtn, mbtn)
if mbtn = 1 then
if mx > 15 and mx < 35 and my > 13 and my < 30 then
%close:fn
open : fn, "inventory.bin", write, mod, seek, read
for i : 1 .. currentRecord - 1
%
prod (i).product := produ (i, 1)
prod (i).manufacturer := produ (i, 2)
if strintok (produ (i, 3)) then
prod (i).number := strint (produ (i, 3))
end if
if strrealok (produ (i, 4)) then
prod (i).price := strreal (produ (i, 4))
end if
if strintok (produ (i, 5)) then
prod (i).reorder := strint (produ (i, 5))
end if
if strintok (produ (i, 6)) then
prod (i).numinstock := strint (produ (i, 6))
end if
prod (i).prodnumber := produ (i, 7)
prod (i).cater := produ (i,
prod(i).sale:=produ(i,9)
seek : fn, (sizeof (inventory) * (i - 1))
Font.Draw ("Writing to file!", 50, 30, font1, red)
write : fn, prod (i)
delay(5000)
Font.Draw("Writing to file!",50,30,font1,white)
%read:fn, prod(i)
%put prod(i).product
%delay(1000)
%close : fn % goes to help
end for
close : fn
end if
if mx > 225 and mx < 250 and my > 13 and my < 30 then
quit
end if
end if
end if
exit when GUI.ProcessEvent
end loop



16v-working.t
 Description:

Download
 Filename:  16v-working.t
 Filesize:  13.25 KB
 Downloaded:  443 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Asok




PostPosted: Mon Mar 10, 2003 10:03 pm   Post subject: (No subject)

Locked, One message is enough. Please reply to this thread: http://www.compsci.ca/bbs/viewtopic.php?t=360

Thank You.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: