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

Username:   Password: 
 RegisterRegister   
 Recorded info
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
_justin_




PostPosted: Mon Mar 06, 2006 4:46 pm   Post subject: Recorded info

Hey all

so i finally got my turiing program to record info and such

code:
var log, connections : int
open : log, "logs.txt", write
open : connections, "connections.txt", write


i have that written at the begining of my program

code:
write : connections, clientAddress


and i have that so that everytime some one connects to my server it writes it down in a .txt file

so then i though i'd be able to record all the text and stuff that people are typing by using a

code:
write : log, clientNick, text


after each time they send the info to the server

code:
   put "Ip Address: ", clientAddr (clientPort)
            put "User- ", clientNick (clientPort), " says: ", text
            write : log, clientNick, text


so i though that would work but for soem reason when i go to open the .txt file it is like 500 mb big after like 5 mins of only 3 users in the chat

and all that shows up in the log.txt is


Quote:
Admin justin € € € € € € € € € € € € € €


and the €'s just keep going on and on

so if you can help that would be awesome

btw here is the loop were the write statement is located

code:
loop
        waitForChar (incomingConnection (clientPort))
        get : incomingConnection (clientPort), text : *
        if text not= "exit" then
            put "Ip Address: ", clientAddr (clientPort)
            put "User- ", clientNick (clientPort), " says: ", text
            write : log, clientNick, text
            put  "_____________________________________________"
            relayText (clientPort)
        elsif text = "exit" then
            put "Ip Address: ", clientAddr (clientPort)
            put "User: ", clientNick (clientPort), " has exited."
            relayServerMessage (clientPort, exitText)
            Net.CloseConnection (incomingConnection (clientPort))
            incomingConnection (clientPort) := 0
        end if
        exit when text = "exit"

    end loop
Sponsor
Sponsor
Sponsor
sponsor
_justin_




PostPosted: Mon Mar 06, 2006 5:42 pm   Post subject: (No subject)

sry i couldn't find the edit button


k but now i kinda fixed it up now i ahve te logs.txt file looking like this though

Quote:
this is a test soon i will have 5 other users in here think you can handle it ? in here yea k you can handle it ? in here exit you can handle it ? in here

as you notice it jsut copies every thing and replaces the

soon i will have 5 other users in here think you can handle it ? in here yea k you can handle it ? in here exit you can handle it ? in here[/b]
Clayton




PostPosted: Mon Mar 06, 2006 5:50 pm   Post subject: (No subject)

just so you know, your obviously new here, but there is no edit button in the help forum, but anyway how long have you been programming? a chat program is pretty cool, but i dont know where that in here is coming from, its an interesting problem
MysticVegeta




PostPosted: Mon Mar 06, 2006 6:52 pm   Post subject: (No subject)

_justin_ wrote:
sry i couldn't find the edit button


k but now i kinda fixed it up now i ahve te logs.txt file looking like this though

Quote:
this is a test soon i will have 5 other users in here think you can handle it ? in here yea k you can handle it ? in here exit you can handle it ? in here

as you notice it jsut copies every thing and replaces the

soon i will have 5 other users in here think you can handle it ? in here yea k you can handle it ? in here exit you can handle it ? in here[/b]


What are you trying to say? I dont understand, speak using full forms of words and proper grammar, really hard to make out what you are saying
_justin_




PostPosted: Mon Mar 06, 2006 9:21 pm   Post subject: (No subject)

Ack now that i re-read it it doesnt really make much sense to me


[quote="MysticVegeta"]
_justin_ wrote:
sry i couldn't find the edit button


k but now i kinda fixed it up now i have the logs.txt file looking like this but
as you notice it just copieswhatever was written before and tries to write over it
Quote:

soon i will have 5 other users in here
think you can handle it ? in here
yea k you can handle it ? in here
exit you can handle it ? in here



so basicly i want the log file to just list the username then what they said
for example

"Justin - hello, world"
"John Doe - Hello,world"
"Jane Doe- Hello, world"


hope that clears things up if not just tell me and i'll try again
MysticVegeta




PostPosted: Tue Mar 07, 2006 11:47 pm   Post subject: (No subject)

try to use "put : fileNo, text" instead of write.
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  [ 6 Posts ]
Jump to:   


Style:  
Search: