Changes

Jump to: navigation, search

Project R0.1 20123- OOP344

5,030 bytes added, 23:56, 21 October 2012
Help
=Due Dates=
*Sun Mon Oct 14th15th, 23:59
=Help=
==Help Needed==
Thanks Omkar, that was all I needed to understand how past this test.
* Omkar Parmar
Re : Amir, after previous test, without pressing any key it will display like this
+--------------------------------------------------------------------+
|Test 4.17: console.edit() initial corrections, Offset: The offset is|
|set to 10 that is invalid and it should be corrected to 5. The |
|function should terminate returning 0. |
+--------------------------------------------------------------------+
+--------------------+
| |
+--------------------+
PASSED, hit any key to continue
 
* Re: Jessica, My question is what is the instruction for test 4.17, but thank you for replying.
* Re: Amir.
Amir, Try to re-download the cio_test.cpp from git and re-compile it again. I had some problem with you. It works fine after I re-upload the text.cpp file. I do not know what happened. - Jessica Park
* Re: Omkar.
Return value of edit is correct. How we should act in test 4.17? pressing arrow keys?
* Student: '''Omkar Parmar'''
'''Amir''' Check return value of edit function
* My program fails at the following test. Anyone knowswhy should it returns Unkown keycode? How it should be handled then! - Amir
+--------------------------------------------------------------------+
|Test 4.17: console.edit() initial corrections, Offset: The offset is|
|set to 10 that is invalid and it should be corrected to 5. The |
|function should terminate returning 0. |
+--------------------------------------------------------------------+
+--------------------+
| |
+--------------------+
- console.edit() was supposed to return Unknown Keycode, Dec: 0 Hex: 0
but instead it returned: ENTER, Dec: 10 Hex: A
FAILED, hit any key to continue
 
*"My program is working completely fine in window but when I am trying to testing it on matrix it gives same error as below."- Tejas Patel
 
To Omkar Parmar: "Write [export TERM="linux"] then try it again"-Tejas Patel
 
* Student :Omkar Parmar
'''HOME,END F1, F2, F3, F4, F5''' keys are not working while testing linux.
HOME,END are return Unknown key and
F1 A
F2 B
F3 C
F4 D
F5 E.
 
* After copying cio_test.o, it has changed MY NAME and R.01 to "CIO TESTER PROGRAM" and "R0.93". I can assume what happened it, but I just wonder it is ok? - Rody Choi <==I think that's it. cio_test.o cannot be edited. I guess cio_test.cpp is submitted as well. - Linpei Fan ===> I guess so. Thanks, Lily - Rody Choi
*I keep getting messages " '''The row and column of the terminal must be maximum of 30 by 100.''' press any key to quit
" when I tried to test it on matrix account. is there anyone who has same problem? - Jessica Park
*:: You need to resize the terminal window because the test program restricts it to 24x80 to 30x100 (rows x cols). You can also edit the size thru preferences/settings if you don't like trial and error - Michael Wang <=== Hey,you have to use the "PUTTY" - Rody Choi<==Just using the "PUTTY" anything will be fined - Jay Feng =>
*When running on matrix, whenever I press Home, End, or Insert, the program exits rather than run the code I wrote. It works fine on Visual Studio however. I complied with -lncurses. - Ronny Wan <-- Check Notes section on this page and follow "Using Linux..." instruction even for Windows version of Putty - Hiroshi Takemoto
<===Try to compile it in a Linux OS, such as Fedora, using VM. It will be fine. - Linpei Fan ===>
==Blog Posts==
* Questions about terminating the process of editing by pressing '''ENTER''', '''TAB''', '''ESCAPE''', '''UP''', '''DOWN'''.... and what your program doing after pressing '''ESCAPE''' were not clear for me, so I decided to ask Fardad, here the answers.Blog: [http://stanislavatseneca.blogspot.ca/ stanislavatseneca]
 
* Here's a post of my troubleshooting issues with compiling the code on OSX. It covers both the terminal c++ compiler and Xcode. [http://gambitkun.blogspot.ca/2012/10/working-with-console-part-2-mac.html mgauer]
** hi guys i would like to know ho you solved these two questions?
in the first one the test ask:
PrnTextBox(1, 5, 70, 8, "Test 4.2: console.edit() initial corrections, Offset: The offset is set to 10 that is invalid and it should be corrected to 5. "//////////
"HIT ENTER ONLY to test!");
in the second test the same question is asked:
PrnTextBox(1, 5, 70, 8, "Test 4.17: console.edit() initial corrections, Offset: The offset is set to 10 that is invalid and it should be corrected to 5. " //////////
"The function should terminate returning 0.");
but how am i going to return 0 and at the same time set the offset to 10. I do not understand those two questions.
=Learning Outcome=
This method edits the C-style, null-terminated string pointed by str. The parameter row holds the row (0 is the top row) of the string on the screen. The parameter col holds the starting column (0 is the left-most column) on the screen. The parameter fieldLength holds the length of the editable field. The string may be larger than the field itself, in which case part of the string is hidden from view. The parameter maxStrLength holds the maximum length of the string, excluding the null byte. The parameter insertMode points to a bool variable that holds the current insert mode of the string. The parameter insertMode receives the address of a variable that stores the current editing mode - insert or overwrite. The parameter strOffset points to an int variable that holds the initial offset of the string within the field; that is, the index of the character in the string that initially occupies the first character position in the field. The parameter curPosition points to an int variable that holds the initial cursor position within the field; that is, the index of the character in the field at which the cursor is initially placed.
* '''''Initial Corrections'''''*:If the initial offset is beyond the end of the string, your function resets the offset to the length of the string; that is, to the index of the character immediately beyond the end of the string. If no offset variable is pointed to; that is, if the address of the variable is NULL, your function sets the offset to the index of the first character in the string; that is, to 0.(to do this have a local variable for the offset that holds zero to be pointed instead of an external variable) *:If the initial cursor position is beyond the end of the field, your function resets the position to the last character in the field. If the position is beyond the end of the string, your function resets the position to that immediately beyond the end of the string. If no cursor position variable is pointed to; that is, if the address of the variable is NULL, your function sets the cursor position to the first position in the field; that is, to position 0.(like the offset, to do this have a local variable for the cursor position that holds zero to be pointed instead of an external variable)
Your function does not allow the cursor to move before the start of the field or past the end of the field. If the field ends at the right edge of the screen, your function does not allow the cursor to the right of that edge.
Local Mac: (use -lcurses to link curses library)
c++ bconsole.cpp console.cpp cio_test.cpp -lcurses-Wno-write-strings
matrix: GNU (use -lncurses to link ncurses library)
g++ bconsole.cpp console.cpp cio_test.cpp -lncurses-Wno-write-strings
For submission purposes, your solution must compile, link, and run without errors in each environment.
==Tester Demo==
To see how tester runs, you can run on Matrix (only use putty with the setting stated at [[#Notes|Notes]]) run:
<big><pre>
$ ~fardad.soleimanloo/cio_test
</pre></big>
 
==Submission details==
The due date for submission is: Mon Oct 15th 23:59
 
When your program passed all the tests, on matrix, create a directory and copy all the source files (console.cpp, console.h, bconsole.cpp, bconsole.h) into it. Then copy cio_test.o from "~fardad.soleimanloo" and then compile your code with your professors version of cio_test (i.e cio_test.o) and run it. If all the tests are passed successfully, an email will be sent to your professor automatically with your source code (console.h and console.cpp) attached to it.
EDITto copy the cio_test.o do the following.<br />From the directory containing all source files: Fardad will release a test program $cp ~fardad.soleimanloo/cio_test.o .to check your compile the code: $g++ bconsole.cpp console.cpp cio_test.o -lncursesThis should not generate any warnings. When you successfully <br />To run this program in the school's Linux environment test (Zenit or Matrixwith automatic submission), it will automatically submit your assignment for you.<s>Method of submission will be announced later $a.</s>out

Navigation menu