Computer Science Canada char question |
Author: | pavol [ Sat Mar 11, 2006 4:59 pm ] |
Post subject: | char question |
what does the char '\n' mean? space or enter or something else? how many characters does it represent? i am totally lost ![]() any help would work for me ![]() |
Author: | md [ Sat Mar 11, 2006 5:03 pm ] |
Post subject: | |
it's a newline character; and it is indeed a single character. The \ indicated an escape sequence and the n indicates a newline character. check out \a (iirc; it's supposed to be a bell) |
Author: | pavol [ Sat Mar 11, 2006 5:15 pm ] | ||
Post subject: | |||
ok thanks. now the reason i asked was because i'm trying to make sense of the chat program in the turing reference thing (the program is under Net.OpenConnection). the thing that bothers me is, me and my friend tried this program out, and whenever he would type something instead of me seeng the letters one after another only until the enter was pressed, in which case it would start a new line, i saw the letters spelled out vertically one letter per line. i hope i haven't confused anyone cuz i've just confused myself even more. ![]() this is the main code where the characters are got and put:
|
Author: | pavol [ Tue Mar 14, 2006 1:05 pm ] |
Post subject: | |
sorry i don't think i phrased my question too well, but i did have a question in the previous post. could anyone give me any pointers on how the fix the problem where the letters appear vertically and one by one? im very confused ![]() thanks in advance ![]() |
Author: | MysticVegeta [ Tue Mar 14, 2006 6:45 pm ] |
Post subject: | |
could you set it up so that we dont need the streams, cause too lazy to create all the files and put in appropriate chars in it. |
Author: | pavol [ Tue Mar 14, 2006 6:47 pm ] |
Post subject: | |
i'm lost ![]() |
Author: | pavol [ Tue Mar 14, 2006 7:03 pm ] |
Post subject: | |
actually i think i know what you mean now. except if i just have the program feed the input variable with random characters, the program works. im not sure if this is right but is there, after every char passed through Net, some kind of Enter-like thing that would make it appear as if the person was pressing enter after every letter. ![]() ![]() ![]() |
Author: | MysticVegeta [ Tue Mar 14, 2006 7:47 pm ] |
Post subject: | |
Could you rephrase that please? I dont quite get what you are trying to do and what I meant by editing the code was that, make the code so that the characters are input-ed? by keyboard not by streams so one can find out the problem. |
Author: | pavol [ Wed Mar 15, 2006 11:15 am ] | ||
Post subject: | |||
ok i made the program so that it gets the chars through the keyboard instead of the stream but if i do that, my program works. it does what it's supposed to. i even tried just feeding it random chars:
but it works (a little glitchy but it does the job, i think). only if i have the original code there, with the streams and everything, it doesn't work. so, what i think is that when i get the char from the stream, there is another character that comes with it instead of the one just typed in: Enter. because when i use the program to connect to someone and chat with them when they type something, on my screen the program puts every letter on a seperate line. is there an enter at the end of every char passed to my program or is it just very messed up. i'm clueless and i hope i haven't confused you even more ![]() |