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

Username:   Password: 
 RegisterRegister   
 Question reguarding the "seek" command
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Junkhead




PostPosted: Tue May 02, 2006 9:14 pm   Post subject: Question reguarding the "seek" command

As far as I know, the seek command works like this:

seek: filestream, position

How does that "position" variable work? Does it seek on the X axis or the Y axis? How does the seek command know when to go down a line in the file? It just isn't clear to me, can someone clarify this?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue May 02, 2006 9:42 pm   Post subject: (No subject)

I'm quite interested in your theory about X and Y axis inside of a file Shocked

What is a line anyways? To me it is a \n character in a continues string of text
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Junkhead




PostPosted: Wed May 03, 2006 11:09 am   Post subject: (No subject)

Well, lets say that the file is arranged in a grid-like formation. See what I mean now?

Moving it X would move the cursor right and left, and moving it Y would move the cursor up and down.
Tony




PostPosted: Wed May 03, 2006 11:22 am   Post subject: (No subject)

there's no such thing, file's content is a continues string. As I've said before, "new line" character is still a character. As such the position can only be moved left and right.

I suppose that if you were to read forward for as many characters as you consider a "line" to be long, you'd move to the "next one"
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Junkhead




PostPosted: Wed May 03, 2006 11:48 am   Post subject: (No subject)

How would I output the contents that this program outputs to the screen in a file then?


sine.t
 Description:

Download
 Filename:  sine.t
 Filesize:  730 Bytes
 Downloaded:  63 Time(s)

Delos




PostPosted: Wed May 03, 2006 12:01 pm   Post subject: (No subject)

Let's clear up a common confusion before we continue. There is a big different between text output and graphical output. As it stands, your programme right now deals with graphical output, despite the fact that the put statements deal with text input.
A heuristic to follow is if you've used commands like locate(), colour(), or anything Draw.(), then you're dealing with graphics. (You could also use setscreen("text") and try to run it from there, you'll get error messages all over the place).

Now that we've established that what you have in your output screen is a drawing and not a series of strings, we can move forward.
It is quite possible to write a file that emulates the drawing you have. You've got a formula going in there, all that remains is for you to figure out where characters will be placed line by line.
One possiblity that springs to mind (a long, inefficient one at that!) would be to create a 2-dim array spanning the screen, and whereever you have a locate(), assign those same coordinates in the array to the same character...
So if you had a "T" being placed at (4, 12) then in your array, element (4, 12) would be assigned a "T" as well.
You could then write the array to a file. Not the best way of doing this, I'd suspect, but it's quick and dirty, and works.
Junkhead




PostPosted: Wed May 03, 2006 5:17 pm   Post subject: (No subject)

Thanks for the help, guys, I think I know where I'm going to take this from here Smile
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: