From hamilton@cs.uregina.ca Wed Sep 1 12:45:37 2010 - ignore dummy line above ------------------------------------------------------------- Question: In test files 5 and 9, the following lines produce errors: (test case 5) 2 0 FSmount littlebiggerdiskfilename fs1 *ERROR 3: Invalid parameter (test case 9) 4 0 FScreate external.02. SFFS 1 0 1000 10 *ERROR 3: Invalid parameter I am wondering if these should in fact be producing errors, and have determined the discrepancy in understanding between your files and my code. The command FSmount has two parameters, described in the phase 1 description as d and f. Where d is the simulated disk and f is the filename the disk is referred to in the file system. What are the requirements of the parameter d? I don't see a description anywhere and your tests seem to indicate it should be treated as a filename, but a don't recall a restriction such as this being mentioned. My understanding was the f parameters was to be a filename, while the d parameter was essentially any string, relating to an external (from the simulated operating system) file. Answer: As stated in the fourth paragraph of the description of Phase One, a disk name, a file name, or a file system name is at most 15 characters long, starts with a letter, and contains only letters or digits and at most one period (.). I think I may have shown it as any string in some lecture, which may be how you got confused. For the final evaluation, please follow the instructions given in the handout. ------------------------------------------------------------- Question: With regard to test case 7, I'm unsure why time entry 3 is rejected: 3 0 FScreate disky4 SFFS 1 0 8888 24 *ERROR 3: Invalid parameter The parameters all seem to be in order. Answer: The size of the file system here is 8888, but in Phase One, the maximum file system size was 8192. ------------------------------------------------------------- Question: I noticed that test case 8 as shown on October 20 on the website displays an error 12 after 8 filesystems have been mounted, but the assignment description states that at most 10 filesystems may be mounted at one time. Is the error message wrong here? Answer: The error 12 after 8 mounted file systems was a mistake. New versions of in1-08.txt and out1-08.txt have been installed on the website (October 21). ------------------------------------------------------------- Question: Is 3840 the correct value to enter into the permission field for the passwords.dat file? Answer: No, 3840 was an error. The correct value is 983040 (decimal), which corresponds to 0xf0000 (i.e., f0000 in hexadecimal). The marker should automatically change the value from 3840 to 983040 (or from 0xf00 to 0xf0000) in your submitted program, if your program is outputting f00 instead of f0000. ------------------------------------------------------------- Question: How do you decide whether or not a character is "printable" in C++? Answer: Easy way: there is a function in C++ called isprint(int c). Given a character, you cast it as an int and pass it to isprint. answer = isprint( (int) mychar); or if (isprint( (int) mychar)) Harder: For every number from 0 to 255, which you often see written in octal (base 8) from 00 to 0377, the answers are shown in the file printable-output.txt available from the Phase 1 web page. ------------------------------------------------------------- Question: When we break apart the command line arguments, what should we do if there are multiple spaces (blanks) between the arguments? Are we supposed to treat the extra spaces as the same as a single space or are we supposed to produce an error message? For example: 0 0 FScreate d1 SFFS 1 0 1024 8 If we are supposed to produce an error message, which error message is appropriate? Answer: You can treat the multiple blanks as a single blank or you can print an error message. You can make up a new error message with a number 80 or higher. ------------------------------------------------------------- Question: How do you decide whether or not a character is "printable"? I know there is an isprint function in C/C++ that determines this, but I can't any function like that in Java. Answer: For every number from 0 to 255, which you often see written in octal (base 8) from 00 to 0377, the answers are shown in the file printable-output.txt available from the Phase 1 web page. ------------------------------------------------------------- Question: How did you produce the time/date information shown in the log file at the beginning and the end. Answer: I used the ctime function in C++. If you are working in another language, you can use another convenient format to display approximately the same info. ------------------------------------------------------------- Question: Do we have to hand in anything on paper? Answer: Yes, please hand in the documentation describing your design, test cases, testing strategy and results, and special feature on paper. See the list of items to hand in at the end of the Phase 1 handout. ------------------------------------------------------------- Question: Do we have to print our program out on paper and hand it in? Answer: No. Please submit it electronically to the mark330 account. Follow the instructions on the website. Also, submit the in1-1*.txt files that you design to test your program and the log files that you obtained as output. ------------------------------------------------------------- Question: How should we handle blank lines in the input file? Should we just skip over that line or give a syntax error? Answer: Either method is acceptable. ------------------------------------------------------------- Question: I was just wondering if we had to use an object oriented model. I currently have all my functions in a single file and am planning on breaking them up into classes or separate files. Will we lose marks if we do not have actual class structures? Or can we create just several files with the functions broken up into there respect groupings (ie system calls, logging functions, etc)? Answer: It is okay to have classes or not. If you don't have classes, I recommend that you break your program into files containing groups of related functions, as you suggested. Then you can describe these groups at a higher level before going into the details. ------------------------------------------------------------- Question: I tried to use diff command on UNIX, but it just gave me feedback like this: Binary files logone1.txt and outone1.txt differ It does not specify line by line the difference between them. Answer: Diff works on ascii files. Make sure that you transfer your .txt file in ASCII mode between machines using FTP. If you use binary mode, it will not work properly. If the file names end with .txt, ASCII mode should be used by default (or check the defaults on the file-transfer program). Also, sometimes, your program puts extra characters, say extra '\0' end of string characters in the output. This may confuse diff into thinking that you have a binary file. ------------------------------------------------------------- Question: I want to use itoa() function that converts integer to string. It works beautifully in VC++, but when I compiled it on UNIX using CC, it doesn't recognize that function and give me this message: "Executable.cpp", line 113: Error: The function "itoa" must have a prototype. I already included: #include #include #include #include #include #include using namespace std; Any idea why ? or is there any function to convert int to string besides itoa()? Answer: itoa is not in the standard for C or C++. You will have to either switch to sprintf or track down the source for itoa. It is a short function. ------------------------------------------------------------- Question: My question pertains to the output of our assignment. I used the diff command to compare my output to the out1-01.txt, and using the more command I stepped through each difference. The outputs looks exactly the same in each case, but my output is formatted using the setw() command, which produces extra whitespace at the end of some lines, thus triggering the difference. Is our output supposed to match exactly, as in the diff command produces absolutely no output except the different start and end times? Answer: Yes, it should match exactly except for the different start and end times. ------------------------------------------------------------- Question: My program works in Visual C++, but on Unix it seems to be reading one extra line from the one1.txt file. It isn't reading the last line twice or anything like that, it is like it is reading a blank line at the end of the file. I'm having problems figuring out what the problem is since it works on Visual, but not on Unix. Any ideas? Thanks. Answer: Make sure that you check for end-of-file after the read statement, but before you use the input data. read while (goodfile) xx read } Make sure that the in1-01.txt is a proper ASCII file that has the last newline in it. Longer explanation: One possible explanation is that your "get/read/cin" statement is the first line of your "while" statement, and the condition of your "while" statement is as long as end of file is not reached. When your "get/read/cin" statement fails due to end of file, you don't stop immediately. Instead you do all the instructions in the loop with the old data still in the variables. Thus, it seems to print the last line twice. The fix is to reorganize the loop as shown above. You can put the "get/read/cin" just before the "while" loop and also as the last statement in the "while" loop. --------------------------------------------------------------- Question: I was just wondering, will we lose marks if our out1-01.txt output file has too many/too few spaces between the words? Answer: Yes, make the output match exactly. ----------------------------------------------------------------- Question: I have my input and output files hardcoded into my program. Will the tester be expected to edit the code to test various file inputs, or do we have to prompt the user for which file they want to use? Answer: The input and output file names must be accepted as command-line arguments by your program. If you are working in C++, please put the start of your main program as int main(int argc, char *argv[]) { Then put argv[1] where you want the name of your input file and argv[2] for the name of the output file. If you have to pass them to function f3, then declare the parameter as char *argv[] . e.g., for an integer function f3, with no other parameters. int f3(char *argv[]) Also, first thing in the main() function, check that argc == 3; if not, print an error message and stop. For Phase 1, if you don't understand command line arguments, just assume input and output go to the console and the marker will use % phase1 < in1-01.txt > out1-01.txt to execute your program. ------------------------------------------------------------- Question: What happens if a line of input has more than one error, but we've error checked in a different order than you expected? Only one error would be printed out, and it may not be the one you're looking for. I'm not sure if a situation like this would ever arise, but I think its a valid question to ask. Answer: Please report any such situation if you see an actual case. If we get to the marking and find this case, you will be allowed to report any one of the errors. The marker should consider reporting any one of the errors correct. ------------------------------------------------------------- Question: I got the first version of my CS 330 project to work in Windows, but when I went over to Hercules, I just got an error where it states that the function atoi() needs a prototype. However, it's part of the library. Is there anything that needs to be specified in Unix to get this library to function properly? Answer: Perhaps you put after the using namespace std or perhaps you used g++ rather than CCstd. I tried the following and it worked fine with CCstd: #include #include using namespace std; int main() { cout << atoi("3456") << endl; return 0; } One possibility is that you could add the following line #include after the using namespace std; line, instead of using the line. If that still doesn't work, try adding the line int atoi(); ------------------------------------------------------------- Question: Should we distinguish between instructions that look like those given in in1-01.txt and those with too few or too many blanks? Answer: You do not have to ensure that the exact correct number of blanks are present between fields in the input file, but you must ensure that the correct number are present in the output file. ------------------------------------------------------------- Question: Is the input in in1-01.txt case sensitive? Also, when we output it to the out1-01.txt file, do you care if everything is in uppercase when it is output? Or do you want everything left intact as it was read in? Answer: The input and output should both be considered case sensitive, so you should - distinguish the cases on input, i.e., if a command is called FSchange, then neither fschange nor FSCHANGE is correct - match the case on output (i.e., if the user entered FSCHANGE, then FSCHANGE is what should be shown in the out file). ------------------------------------------------------------- Question: In CS210, I wrote functions for handling linked lists. Can I use the same code as part of this project? Answer: Yes, you can use your own linked list functions or ones from some text book, as long as the origin of the functions is clearly marked. Put a comment at the top of the file (or section of the file) containing the linked list functions from elsewhere. -------------------------------------------------------------