PLEASE NOTE: the upgrades to this server,, have not yet been completed.
Hopefully the changes will be completed on THURSDAY 8th December.
Web-based programs, such as csmarks, cssubmit, and the help fora, will be unavailable at some time on Thursday 8th.
  It's UWAweek 49


This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

Displaying 191 tagged articles
Showing 191 of 919 articles.
Currently 4 other people reading this forum.

 UWA week 43 (2nd semester, study break) ↓
SVG not supported 9:05pm Wed 26th Oct, Songxin S.

Hi Chris, For testfiles 8, all three commands run 31 times so I am under the impression that it would not matter which command out of the three is displayed on the last line? Due to the way my code is structured, long-command was printed instead of sho...

SVG not supported 2:11pm Wed 26th Oct, Huxley B.

Thanks, I tried that and I'm now getting 25 25 on the sample solution as expected. Strangely, I'm now also getting 25 25 on the code that I submitted, even though that's not what I got on csmarks.

SVG not supported 2:01pm Wed 26th Oct, Christopher M.

We're definitely looking into this. One suggestion (unsure if it's been tried or successful on WSL), is changing line 3 of the script from PROJ "estimatecron" to PROJ ". estimatecron" Those that don't have '.' inn their shell's search path should,...

SVG not supported 1:58pm Wed 26th Oct, Huxley B.

I've been trying to run the marking script on my project, but it doesn't seem to be working as expected (I'm on Windows using WSL). For example, I got 2 2 for test1 (according to csmarks), but when I run the marking script, I only get 1 2 for test1. ...

 UWA week 42 (2nd semester, week 12) ↓
SVG not supported 5:48am Sun 23rd Oct, Christopher M.

The marks for the 1st project are now FINALISED, unless your mark is still 'Not Available' or if I've emailed you over the weekend. ... Project-1 marks and feedback are now available in csmarks. Project submissions were made by 121 individuals and 98 tea...

 UWA week 38 (2nd semester, week 8) ↓
SVG not supported 7:30am Sun 25th Sep, Christopher M.

Now that all students with Special Considerations and UAAPs appear to have submitted their 1st projects, you may download the sample solution from https units CITS2002 projects estimatecron-sample.c The sample solution pro...

 UWA week 37 (2nd semester, week 7) ↓
SVG not supported 4:03pm Fri 16th Sep, ANONYMOUS

Hi Chris - I'm curious if you have any thoughts on Github Copilot? Cheers.

SVG not supported 11:50am Fri 16th Sep, Christopher M.

ANONYMOUS wrote Other than what's stated in the last paragraph of this https run help2002?p np opt B239 YES, you should always provide attribution for code that you did not write - you cannot implicitly claim it as your own.

SVG not supported 11:38am Fri 16th Sep, ANONYMOUS

Hello, For project 1 I wanted to clarify if we use code from parts of StackOverflow answers or tutorial websites do we need to reference where we got the code from or is that not required if it's the same way anyone else would have solved the problem...

SVG not supported 9:15am Fri 16th Sep, Matthew C.

Note to self providing small projects for students is not a profitable career. )

SVG not supported 8:17am Fri 16th Sep, Christopher M.

Disappointing that the average bid was only US 156; it was worth more than that https projects c-programming develop-system-utility-program-language refs https students Getting-started Student-conduct ht...

SVG not supported 5:54am Fri 16th Sep, Christopher M.

Hi Thomas, You are correct that pass-by-value will always be more expensive, both in terms of required space on the runtime stack and in the time required to copy the data before calling the function. On contemporary CPUs, all pointers are the same s...

SVG not supported 5:16am Fri 16th Sep, Christopher M.

ANONYMOUS wrote Yes, printing with printf() will be fine.

SVG not supported 5:14am Fri 16th Sep, Christopher M.

No simple answer. Depending on how much code was similar, it would likely be detected by the software we use. If too similar, the students would be contacted, asked to explain, and possibly be interviewed to see what each understands.

SVG not supported 10:07pm Thu 15th Sep, Ryan W.

If they chose to submit as 2 individuals, is it acceptable that most of the code is the same or is that considered collusion plagiarism and at least one of the two would need to start the project again from scratch?

SVG not supported 8:17pm Thu 15th Sep, ANONYMOUS

Hello, According to 10 of the Project requirements and fine-print, our program is required to provide 3 words separated by one-or-more whitespace characters. My current program prints these outputs using printf(). This might be a unnecessary question...

SVG not supported 7:36pm Thu 15th Sep, Thomas M.

Hi Chris, I was wondering (mostly out of curiosity but also regarding the project) whether pass-by-value or pass-by-reference requires more memory? I would imaging that pass-by-value, would require a lot of memory for making copies, especially when dea...

SVG not supported 3:14pm Thu 15th Sep, Christopher M.

We hadn't planned or budgeted for it, and we've had additional people in the labs Tue-Thu this week. Attached is the lab bookings for this week.

SVG not supported 2:58pm Thu 15th Sep, ANONYMOUS

Would it be possible to have an extra lab session tomorrow 16th Sep either in the morning or late afternoon as we won't have a workshop session anyway?

SVG not supported 1:59pm Thu 15th Sep, Christopher M.

ANONYMOUS wrote One submission per team, please. As a team, you need to decide which is the better code, else submit as two individuals. (I imagine that if your team made two submissions, you'd expect to receive the higher mark??)

SVG not supported 9:40am Thu 15th Sep, ANONYMOUS

Hi Chris, May I ask,is it possible for a team to submit two copies? I know that "If working as a team, only one team member should make the team's submission". But there are some changes and differences in our own code and we have different opinions o...

SVG not supported 5:45am Thu 15th Sep, Christopher M.

ANONYMOUS wrote As asked and answered many times on this forum, each command name will only appear once in an estimates file. As asked and answered many times on this forum, a blank line is neither a comment-line or a command-line and, so, is an error...

SVG not supported 5:37am Thu 15th Sep, Christopher M.

ANONYMOUS wrote The description of the marking emphasis and marks breakdown meets the requirements of the Assessment Policy and has been approved; it just may look different to how rubrics are presented in other units. There are many, many, examples ...

SVG not supported 10:25pm Wed 14th Sep, ANONYMOUS

Do we suppose to report an error for this situation? Same command name with different execution times in estimates-file And also I want to double-check that if there is an empty line without a ' ', do we report an error or ignore it?

SVG not supported 7:25pm Wed 14th Sep, Christopher M.

I cannot imagine why you re using floating point values in this project, and suggest you try to remove them.

SVG not supported 7:20pm Wed 14th Sep, ANONYMOUS

I use fmod and floor from the math.h library, it seems this library must be explicitly linked to when compiling... https questions 332884 how-to-compile-a-c-program-that-uses-math-h

SVG not supported 7:03pm Wed 14th Sep, Christopher M.

ANONYMOUS wrote Was not anticipating compiling with -lm Why do you need it?

SVG not supported 6:53pm Wed 14th Sep, ANONYMOUS

When compiling my project I am required to add a -lm flag at the end of the command to link the math.h library otherwise it won't compile. Will this flag be used when compiling our projects for marking? For reference I am using gcc compiler on Ubuntu ...

SVG not supported 6:19pm Wed 14th Sep, ANONYMOUS

thank you

SVG not supported 5:50pm Wed 14th Sep, ANONYMOUS

Hello, I was wondering if there was a marking rubric released for this project? I am aware of the 25 marks for correctness and 25 for programming style, however is there a further breakdown of the 25 marks within each of these sections? In particular,...

SVG not supported 3:59pm Wed 14th Sep, Christopher M.

The loop include stdint.h for(uint64 t i 0 ; i UINT64 MAX ; i) ... will loop 18,446,744,073,709,551,615 times, but I won't be waiting for it.

SVG not supported 3:55pm Wed 14th Sep, ANONYMOUS

Hello, I was wondering, is there a limit to how many times a for loop can iterate? If I was to have a loop with over 40000 times, would that pose certain issues?

SVG not supported 11:44am Wed 14th Sep, Christopher M.

ANONYMOUS wrote Both of them must already have a null-byte on the end of them, else they wouldn't be strings (or, if lucky, string handling functions would crash). Could either of them be a command name, from the last column of the crontab file? If so...

SVG not supported 10:18am Wed 14th Sep, ANONYMOUS

Hi, I'm trying to use strcmp but I've run into an issue where whilst the two command strings look the same, they are of different lengths ( 1 difference). This means I can't use my strcmp() step as they are not exactly the same. From what I can see I ...

SVG not supported 6:20am Wed 14th Sep, Christopher M.

ANONYMOUS wrote The strdup() function is not part of the C99 or C11 standards (but is, finally, defined in the new C23). However, it has been defined in the POSIX standards for a long time, and this post https run help2...

SVG not supported 12:42am Wed 14th Sep, ANONYMOUS

Hi, is it necessary to compile with -std c11? I am getting this error when I compile with this c11 standard, eventhough I have included the string library error implicit declaration of function strdup ; did you mean strcmp ? -Werror implic...

SVG not supported 4:54pm Tue 13th Sep, Christopher M.

Use this one.

SVG not supported 4:44pm Tue 13th Sep, ANONYMOUS

With respect to the project brief, it was stated "Only the very last line will be considered during (automated) marking." Does that mean we shouldn't add a new ' n' after. As in, would printf(" s d d", mostExecuted, totalCommands, maxRunning); an...

SVG not supported 4:40pm Tue 13th Sep, Christopher M.

ANONYMOUS wrote If you're iterating from the first minute (starting at 12 00 midnight on the first day of the requested month) to the last minute (44K of them) you need to match the current minute against the 'pattern' of 5 numbers "0 3 ". I...

SVG not supported 4:27pm Tue 13th Sep, Christopher M.

ANONYMOUS wrote How you read in the two files is really a decision for you to make. There's no technical reason, related to C and the OS interface, that would prevent your suggested approach from working. I'm honestly unsure what you mean by an 'alignm...

SVG not supported 2:37pm Tue 13th Sep, ANONYMOUS

I have the same question and am stuck on this, too. If we loop over the entire month in minutes, how would we know at what time the command should be executed? Let's say "0 3 say hello", would we 'execute' at the 180th minute? How is it possi...

SVG not supported 2:24pm Tue 13th Sep, ANONYMOUS

Hello there, couple of questions we read in the estimates file within the same function that is reading in the crontab file? 2.and how do we align both commands and crontab entries so when we access them, they coincide?

SVG not supported 5:36am Tue 13th Sep, Christopher M.

ANONYMOUS wrote That's about the simplest approach - iterate through each of the 40K minutes of the month, checking to see if any of the crontab entries match the current time date. Do not worry about efficiency for your first 'attempt' - in fact don...

SVG not supported 3:01am Tue 13th Sep, Christopher M.

I think you've misunderstood the project's requirements. The second word of the final output line is the "the total number of commands invoked" (Project Requirements 10), and this example correctly reports 30 30 60. It's not the total number of t...

SVG not supported 9:37pm Mon 12th Sep, Gihad C.

the sample solution appears to count 2 distinct processes as one process if they start at the same time despite having different names and runtimes... crontab 0 4 8 process-1 0 4 8 process-2 estimates process-1 1 process-2 2 output " command ...

SVG not supported 8:02pm Mon 12th Sep, ANONYMOUS

Hello friends I have been stuck for a while now on conceptualising a logical flow for simulating the running of the crontab processes. My plan was to have a while loop to iterate through every single minute in the target month, updating the counts of ...

SVG not supported 3:34pm Mon 12th Sep, Christopher M.

Don't worry - we've all done that before -)

SVG not supported 3:14pm Mon 12th Sep, Rados M.

I have just looked over it and realised that I inputed 2 when I meant feb by mistake Thank you.

SVG not supported 1:02pm Mon 12th Sep, Christopher M.

Hi Rados, Yes (I hope so); it also implements helpful debug output, but that is not required. Do you have an example of what fails? The line 0 3 31 1 daily-backup is correctly detected reported as an error. The reverse does not hold. That's a possi...

SVG not supported 12:48pm Mon 12th Sep, Rados M.

Hi Chris, Is the sample solution done to the full requirements of the project (would it recieve full marks)? I ask this because the sample solution accepts a cron file input that contains a command run on the 31st of feb. Do I have to reject that as an ...

SVG not supported 11:38am Mon 12th Sep, ANONYMOUS

Hi, if we wanted to simulate the execution of our tasks within a given month, how would we run a timer to coincide with the scheduled timing and store them? I've declared struct tm and assigned their values to the fields of my task structure but I do...

 UWA week 36 (2nd semester, mid-semester break) ↓
SVG not supported 3:03pm Sun 11th Sep, ANONYMOUS

Ah fixed the issue, if anyone had a similar issue, it was due to the line break formatting of the TXT file from Unix (LF) and Windows (CR LF)

SVG not supported 2:30pm Sun 11th Sep, ANONYMOUS

I have a weird issue with my program that it is working perfectly with certain TXT files but once I replace them with new ones it doesn't work (output is incorrect - only displays 2 processes). Even if they have the exact same information inside onl...

SVG not supported 6:40am Sun 11th Sep, Christopher M.

ANONYMOUS wrote The Project's Requirements point 8 states "8. Your project only needs to simulate the execution of processes for the requested month (of the current year). All processes will have terminated before the end of the requested month."

SVG not supported 11:14pm Sat 10th Sep, ANONYMOUS

Hi just to clarify, if a command has been invoked but not finished i.e.terminated because the time exceeded the month, will it still be counted as executed?

SVG not supported 8:01pm Sat 10th Sep, Christopher M.

Yes (and the month and day names, too).

SVG not supported 7:50pm Sat 10th Sep, ANONYMOUS

Hi, Are we allowed to hardcode the number of days in a month? Thanks

SVG not supported 5:45pm Sat 10th Sep, Christopher M.

The 'P' in POSIX stands for Portable, so (correctly) using POSIX functions is very unlikely to be causing problems. That's true, but having such significant problems on a platform used by millions of people suggests a problem in the project code, whic...

SVG not supported 11:01am Sat 10th Sep, Matthew C.

Maybe you are making system calls that are not portable? Or using POSIX headers? I would have assumed that the program would fail to compile in that case, but not certain. Either way the project won't be tested on windows.

SVG not supported 9:26am Sat 10th Sep, ANONYMOUS

Hi, When I compile and execute my program for Project 1 from VSCode or Windows PowerShell (as an .exe) it sometimes prints the correct value and sometimes doesn't print at all (just returns a new prompt for new entry). In Ubuntu, the compiled file pri...

SVG not supported 7:09am Sat 10th Sep, Christopher M.

ANONYMOUS wrote I suggest that you review our Workshop which involved days and months. And https onlinepubs 9699919799 functions mktime.html

SVG not supported 5:36pm Fri 9th Sep, ANONYMOUS

Hi, I'm unsure of how to check the weekday names. Whether this is 1.Checking that they create a valid date with the month and day within the month provided 2.Being able to grab only i.e. Mondays out if the day in month is an asterisk. Thanks for any help...

SVG not supported 11:15am Fri 9th Sep, ANONYMOUS

i've built all the structures and panned ahead, currently just printing outputs as I implement each function to make sure its doing what I expect before adding anything else. the output I included is just the whole char array line from fgets() befor...

SVG not supported 6:36am Fri 9th Sep, Christopher M.

ANONYMOUS wrote From your own example output, it should be clear that fgets() is not the problem - it's your code to break the line (now in a character array) into words, or that you are not converting storing the words correctly (unsure if y...

SVG not supported 4:59am Fri 9th Sep, Christopher M.

ANONYMOUS wrote This question was also asked in Workshop-5; unfortunately it's still the same answer - no. It's part of your learning for the project to anticipate the possible types of commands and their times. But, there really are no (possible) tri...

SVG not supported 11:55pm Thu 8th Sep, ANONYMOUS

Hi everyone, Having an issue getting over the segmentation fault hurdle, I have spent days trying different approaches and still cannot figure out where its coming from. To quote Chris' response to another post they "nearly always occur when accessing...

SVG not supported 10:23pm Thu 8th Sep, ANONYMOUS

Hello Chris This might be a bit of a request but if possible, do you think you could list a bunch of inputs for the files so we can thoroughly check our codes? It's pretty difficult to come up with an extensive list of inputs for debugging -( I und...

SVG not supported 3:28pm Thu 8th Sep, Christopher M.

ANONYMOUS wrote It's not an error message, just an 'announcement' printed by your zsh that the execution state of your process has changed. There's an explanation of what's happening (in the case of vim) here https run help2...

SVG not supported 3:23pm Thu 8th Sep, ANONYMOUS

Thank you for that clarification, I wanted to know more why this type of message is being returned rather than how to escape the suspension from my shell. I fit is not pointing to anything to do with the while loop what would other causes of this err...

SVG not supported 3:13pm Thu 8th Sep, ANONYMOUS

Hello I've got a question about retrieving values from a struct for this project, if someone can please help me with if we wanted to match a given value with a corresponding struct's field value, would it make sense to Firstly, for example, match an...

SVG not supported 3:01pm Thu 8th Sep, Christopher M.

ANONYMOUS wrote There should be very few differences; the main one I can think of is the amount of memory that may be allocated to local variables (on the runtime stack). (meaning of "...exported to linux" ?)

SVG not supported 2:59pm Thu 8th Sep, Christopher M.

ANONYMOUS wrote Just Chris will be fine. This looks like you are suspensing the execution of your running program by typing Control-Z. If you wish to interrupt (terminate) a running program, the correct key sequence is Control-C. The message is being ...

SVG not supported 2:56pm Thu 8th Sep, Christopher M.

Yes (of course), you may have any number of calls to printf() and any number of return statements in a single function. Whenever tempted to ask such a question, test things yourself by writing a small, stand-alone, program, independent of your p...

SVG not supported 1:09pm Thu 8th Sep, ANONYMOUS

Hi, are there any general reasons that a program that works fine for windows throws a segmentation fault when it's exported to linux so that I can look to see if any of that occurs in my code?

SVG not supported 1:08pm Thu 8th Sep, ANONYMOUS

Good Afternoon Christ, I am using for loops in my main functions to check for validity of time.h variable of month to check that the input month is not a null byte. Although my functions compile, they don't seem to run (even when I just try to run on...

SVG not supported 11:40am Thu 8th Sep, ANONYMOUS

Can we have a printf statement and a return statement in one function? I want to debug my code by ensuring that the values I'm retrieving from my data structure are what I want (using printf()). But if I have a return statement and call printf, nothi...

SVG not supported 4:05am Thu 8th Sep, Christopher M.

Hello, You are correct - the sample solution was accepting 59 as a valid minute, whereas it should really only accept 59. The same applies for all other expected numeric fields, too. I've changed the sample solution to accept 59, but to reject 59 (...

SVG not supported 11:31pm Wed 7th Sep, Jiayang Y.

Hi, have a question I found lines such "59 3 0 0 submit-project" in crontab-file can be invoked, exit(0)in the sample, but I am confused is "59 " a reasonable minute to think?

SVG not supported 3:46pm Wed 7th Sep, Christopher M.

If you just pass endptr to the function, a copy of endptr will be passed (just the same as if you just passed an integer, or the result of any expression). If the function tried to modify that parameter, it would modify the copy of the original val...

SVG not supported 3:37pm Wed 7th Sep, Gihad C.

Sorry I'm still not quite clear on this; what would you effectively be asking the compiler processor to do if you just passed endptr instead of endptr to strtol? If endptr was a simple char and we wanted to change its value, I understand you'd have t...

SVG not supported 3:31pm Wed 7th Sep, Christopher M.

ANONYMOUS wrote These limits are guaranteed, you do not need to check against for them. They tell you the maximum size of variables that will be suitable to store the files' data.

SVG not supported 3:28pm Wed 7th Sep, Christopher M.

ANONYMOUS wrote If endptr was just an integer, and you wanted the function to be able to change that integer's value, you'd have to pass the address of endptr to the function. Similarly, even if endptr is a pointer to a char, if you want the function ...

SVG not supported 3:27pm Wed 7th Sep, ANONYMOUS

The project fine print states "The crontab-file and the estimates-file will each contain at most 20 non-comment lines. Each line will be at most 100 characters long, and each command name will be at most 40 characters long." Does this mean we are guar...

SVG not supported 3:25pm Wed 7th Sep, Christopher M.

ANONYMOUS wrote The most likely cause of this is attempting to write too many characters into a local variable that is a character array. The compiler 'plants' extra information on the program's runtime stack to detect this form of problem - when ...

SVG not supported 2:04pm Wed 7th Sep, ANONYMOUS

hello, i have a question about the use of pointers in strtol, strtol(char , endptr, int) takes a string input (which it attempts to convert into an int), a pointer to a (previously declared) empty pointer, which it uses to return a pointer to the ...

SVG not supported 10:24am Wed 7th Sep, ANONYMOUS

Hi, I've had a "stack smashing detected" error come up. I'm not too sure how to start debugging this so any help would be appreciated. Thanks

SVG not supported 12:42pm Tue 6th Sep, ANONYMOUS

Yes, this makes sense. I've used my functions to assign the values but somehow it's reading the first two values of my file line as asterisks when only one of the values is an asterisk, and it halts my printing at the first line.

SVG not supported 5:09am Tue 6th Sep, Christopher M.

ANONYMOUS wrote This sounds like a simple coding problem (in your code), not a misunderstanding, or something strange, with C's semantics. There are no 'duplicate' lines. It's your code that's printing any duplicate (copies of) lines, so you'll ne...

SVG not supported 10:30am Mon 5th Sep, ANONYMOUS

Yes, I asked this question poorly, my bad. My program is reading the file but it's duplicating desired lines for the total number the lines of the file (e.g 7 desired lines, printed 19 times - the total lines of file). How do I remove duplicate lines...

SVG not supported 6:20am Mon 5th Sep, Christopher M.

ANONYMOUS wrote If working on a standard Ubuntu distribution, the default compiler (which we invoke with cc) is gcc, and the default command-line (not GUI based) debugger is gdb. However you may need to install gdb from a package if not already inst...

 UWA week 35 (2nd semester, week 6) ↓
SVG not supported 8:36pm Sun 4th Sep, ANONYMOUS

Hi, I am wondering how we can debug our code on ubuntu (or any other easy way)? Thank you.

SVG not supported 5:05pm Sun 4th Sep, Christopher M.

Yes, as stated in lectures and workshops, and written here https run help2002?p np opt B239

SVG not supported 5:03pm Sun 4th Sep, Christopher M.

ANONYMOUS wrote Just 'Chris' thanks; I am not a teacher. No. - appending ".txt" does not make a file a text-file (adding ".doc" does not make a file an MS-Word document) - a filename ending in ".txt" only suggests, but does not cannot enforce, that a...

SVG not supported 4:35pm Sun 4th Sep, Simon E.

The function in question is adapted from the first day of month.c file provided as part of the week 2 workshop

SVG not supported 4:32pm Sun 4th Sep, Simon E.

Are we permitted to use small samples of code from workshops (i.e. a single small function) in our project? Thanks

SVG not supported 12:41pm Sun 4th Sep, ANONYMOUS

Hi teacher Because the command line receives the file name without a suffix as "crontab-file" and it is a text file, should I change it to "crontab-file.txt" and then read it?

SVG not supported 5:33am Sun 4th Sep, Christopher M.

- From the project description "command lines consist of at least 6 'words' separated by one-or-more whitespace characters..." At least. - What does the sample solution do?

SVG not supported 12:47pm Sat 3rd Sep, Martin E.

If a command line within the crontab-file contains words after the command name, should it just be ignored, or should it be counted as an error. For example; execute a command at 3AM every day 0 3 daily-backup ERRORWORD? 15 4 d...

SVG not supported 5:41am Sat 3rd Sep, Christopher M.

ANONYMOUS wrote Hopefully you're just asking this question poorly, or asking the wrong question, but there's no need to delete anything from input files, or even to write new files, for this project.

SVG not supported 5:40am Sat 3rd Sep, Christopher M.

ANONYMOUS wrote Glad that you've made progress, although your explanation of why(?) doesn't build confidence that you've really fixed it. Segmentation faults nearly always occur when accessing memory that you process doesn't own, typically by accessi...

SVG not supported 5:36am Sat 3rd Sep, Christopher M.

As you've discovered, there's no native support for sets in C, and no widely adopted 3rd-party approach. Most implementations, yes, just use arrays of bools or chars; more exotic ones, often seen in code for vector embedding, etc, use all individual ...

SVG not supported 5:31am Sat 3rd Sep, Christopher M.

ANONYMOUS wrote This is a reasonable approach, though keep in mind that some fields of each struct tm are not specified in the crontab file (as they are not required). I've found it helpful to use the same field names, simply for readability.

SVG not supported 9:02pm Fri 2nd Sep, ANONYMOUS

How do we delete lines from a file we no longer need instead of placing each unwanted character with a null byte?

SVG not supported 6:03pm Fri 2nd Sep, James A.

No, a value of 0 isn't valid in the estimates file. You can try it out in the sample solution to see how it behaves in that case.

SVG not supported 4:30pm Fri 2nd Sep, ANONYMOUS

ANONYMOUS wrote It seems to be working now, I think, as the error isn't appearing. On another note, how do we know that our file has been read? I'm using sscanf() to read the crontab file but the program doesn't return anything. When I use sscanf(), ...

SVG not supported 3:04pm Fri 2nd Sep, Cohen R.

Can a program have a runtime value of 0 in the estimates file. I discovered that if there would be 0 or negative value it would mess up my program. Should I throw an error if I see this? Thank you

SVG not supported 2:18pm Fri 2nd Sep, ANONYMOUS

Hi, I'm getting a 'Segmentation fault 11' when running my program. All I have in my main function is checking the number of arguments, calling a reading-file function and printing a newline character. What does this 'fault' mean? Is my program even ...

SVG not supported 9:14am Fri 2nd Sep, Christofle S.

Hello. is there a way to use sets in c? I've tried google but most of the answers are flying over my head. I want to set a Set with names of the valid month and commands in estimates files to cross-check inputs. Should I just use an array, and iterate ...

SVG not supported 10:44pm Thu 1st Sep, ANONYMOUS

This is me thinking out loud should we be allocating the time values of 'struct tm' to the crontab values, so that tm min, tm hour, tm mday, tm month and tm weekday align with the syntax of our crontab files, so that our simulator knows which argume...

SVG not supported 2:44pm Thu 1st Sep, Christopher M.

Something a bit more descriptive than your second suggestion would surely be better. The sample solution just says 'dog' is an invalid month ... I'm struggling to find a reference to an old joke about Unix being very terse in reporting its errors - s...

SVG not supported 11:26am Thu 1st Sep, Simon E.

Hi The project states that we need to report errors occurring in the crontab estimates file. Does this error message need to include information such as "Invalid month on line X of crontab file", or can it just say "Error detected in crontab file"? Tha...

SVG not supported 5:29am Thu 1st Sep, Christopher M.

ANONYMOUS wrote There's certainly no need to use another file; unless the amount of data exceeds what can 'easily' fit in a computer's RAM, or if we wish to retain data for a long period, the usual approach is to read data from a file (once) and sto...

SVG not supported 1:26am Thu 1st Sep, ANONYMOUS

Would a struct be ideal for storing commands of a month, number of commands, max number of commands of each month (to be returned at the end)?

SVG not supported 1:19am Thu 1st Sep, ANONYMOUS

Hello, would we need to transfer the file contents to another file by writing or would we be storing them in an array? I read the lecture notes covering writing into files but is this necessary here? And would we need to remove carriage-returns or ne...

SVG not supported 2:13pm Wed 31st Aug, ANONYMOUS

Great What a breath of relief, thanks.

SVG not supported 6:13am Wed 31st Aug, Christopher M.

ANONYMOUS wrote The sample solution, today (it keeps getting improved ), has 520 lines, of which 390 are lines of code (including all its debug statements). You may run the following shell commands to count yours bin echo -n 'total lines ' ; wc...

SVG not supported 6:05am Wed 31st Aug, Christopher M.

ANONYMOUS wrote No. This was a question asked in the Workshop. The format of our crontab files is greatly simplified compared to the format supported by the system-provided cron utility. If our 1st project required the complex combinations you've list...

SVG not supported 9:55pm Tue 30th Aug, ANONYMOUS

ANONYMOUS wrote I just rewatched the workshop and realised the sample solution consists of 380 lines. My bad. A big part of my code is from lecture slides, though, for example reading in files. I hope that's valid.

SVG not supported 9:26pm Tue 30th Aug, ANONYMOUS

Hi, how many lines does the expected solution consist of for Project 1? I currently have over 200 lines but am not sure if this what others have (approx) or if I'm completely out of it and writing a lot of unnecessary code. Reading in the file spans ...

SVG not supported 8:35pm Tue 30th Aug, ANONYMOUS

Hi, would we need to account for other, more complicated combinations such as, 1-20 or 8 (every eighth month) or 0-20 2 and such in the crontab file?

SVG not supported 11:22am Tue 30th Aug, Christopher M.

It doesn't matter, provided it's not a value that could be valid as a 'fixed' (non- ) value. But you wouldn't use NULL, because NULL represents a NULL-pointer and it's not an integer.

SVG not supported 11:04am Tue 30th Aug, Cohen R.

I'm storing many of my values into int arrays but since there can also be I don't know what value I should use to store them. I'm thinking of -1 or NULL but would be wondering if there would be an issue with either of these (convention or otherwise...

SVG not supported
1st project Output 👍x1  (all 5)
5:24am Tue 30th Aug, Christopher M.

ANONYMOUS wrote It's an unusual goal; generally robust programs are written to handle all possible inputs, detecting and reporting invalid inputs, and correctly handling valid inputs. But, for example, we couldn't imagine or generate all possible in...

SVG not supported 4:55am Tue 30th Aug, Christopher M.

I'm surprised that fflush() didn't appear to work for you. The following program works as I'd expect, flushing its output every 4th character. include stdio.h include unistd.h int main(int argc, char argv ) for(int i 0 ; i 20 ; i) ...

SVG not supported 5:56pm Mon 29th Aug, ANONYMOUS

Hello, considering the many potential combinations the crontab file can have (based on the positioning and combination of the and integers).. how do we ensure we have captured every combination of the file? Thank you

SVG not supported 4:27pm Mon 29th Aug, Cohen R.

Aaah sorry, your message didn't come up. Thank you for the response. I did try fflush and it still didn't work. I will try out setbuf( stdout, NULL ); Thank you

SVG not supported 4:26pm Mon 29th Aug, Christopher M.

Didn't like or understand my reply?

SVG not supported 4:24pm Mon 29th Aug, Cohen R.

Nevermind, I changed some stuff and now it's working. I still have no idea what happened though. if anyone has any idea, please still let me know.

SVG not supported 2:39pm Mon 29th Aug, Christopher M.

When using printf() the output is buffered (pending) until you 'flush' it out with a newline character, call fflush(stdout); or when the whole program terminates (and exit() flushes all non-empty output streams). If you want to alway...

SVG not supported 2:35pm Mon 29th Aug, Cohen R.

Hello, I am having a weird error with my print statements where when I do printf(" c", ch); nothing prints on the screen but when I do printf(" c n", ch); all the characters print a line apart. Do you have any idea why this might occur. I can confirm ...

 UWA week 34 (2nd semester, week 5) ↓
SVG not supported 5:00pm Sun 28th Aug, Christopher M.

Hello Juliana, The crontab file is 'unlimited' in that it can contain requests to run commands at any date time, in any month and any year. But we only need to simulate the execution of commands for a particular month (of the current year), as specif...

SVG not supported 4:56pm Sun 28th Aug, Christopher M.

Yes - nothing wrong with wishing to run the same command at multiple times throughout the month. Try it for yourself on the sample solution.

SVG not supported 12:10pm Sun 28th Aug, Juliana SF.

Hello there, just have a few questions 1. Do we have to create values(cron tasks) for every month of the year? Or do we only account for one month of the year? Not very clear in the project description. 2. How would you like us to submit in a single s...

SVG not supported 11:51am Sun 28th Aug, Martin E.

I was wondering if commands can show up twice in a crontab-file e.g. 0 3 deep-thought 0 4 deep-thought and are they to be treated as the same for tallying.

SVG not supported 10:05am Sun 28th Aug, Christopher M.

ANONYMOUS wrote Asking questions is fine, but please first watch Workshop-5 and run the (new) sample solution https run estimatecron-sample Neither. Print the name of the command which is executed most frequently throughout ...

SVG not supported 9:23am Sun 28th Aug, Christopher M.

You may run a sample solution to the project via https run estimatecron-sample To execute this sample, enter the required month (of the current year) into the textbox, select your crontab-file and estimates-file (from your loc...

SVG not supported 6:32am Sun 28th Aug, ANONYMOUS

Hello, Ive got a couple questions regarding the output of the project 1. When you say name of most frequently executed command does this refer to the command with the most number of minutes from the estimates file? Or is it that if a command i...

SVG not supported 10:43am Sat 27th Aug, Christopher M.

ANONYMOUS wrote Yes, but I think clearer summaries are provided here - a list of standard C99 functions here https cplus cliblist.html - a list of POSIX functions here https cplus posixlist.html both listed on https ...

SVG not supported 10:39am Sat 27th Aug, ANONYMOUS

I am a bit confused as to the "system's standard library (providing OS, C, and POSIX functions)." Would it be correct to say that all the header files we are allowed to include are contained in the following? https w c header http...

SVG not supported 6:14am Sat 27th Aug, Christopher M.

Hello, Your questions seem more related to programming in general, rather than this 1st project or C, in particular. While very relevant questions, they're best discussed with a project partner. Some of the issues and choices were mentioned in Workshop-...

SVG not supported 4:57pm Fri 26th Aug, ANONYMOUS

Hi I'm thinking about how to do the project, and was hoping to get a bit of help before the weekend commences. Any guidance with the following is appreciated 1. I am thinking that we only want to read the Estimate file once and somehow store its val...

SVG not supported 12:53pm Fri 26th Aug, Christopher M.

The project doesn't require you to print out any explanation of how your project is working - in fact only the last line of output is considered during marking. However, you'll invariably want to print some 'debug' output while developing your project...

SVG not supported 6:07am Fri 26th Aug, Christopher M.

Neither EOF or NULL are actual bytes that are read from a file - if you think about it, any program could write the byte with value -1 (EOF) or 0 (NULL) into a file and follow it by more data, but that byte doesn't signify the end-of-file. Instead,...

SVG not supported 4:41am Fri 26th Aug, Christopher M.

Thanks for everyone's (correct) responses. Command-names in the crontab file are guaranteed to appear in the estimates file (no need to check for, or report, an error). Command-names appearing in the estimates file might not be ever used in the cront...

SVG not supported 10:17pm Thu 25th Aug, Huxley B.

I'm pretty sure it would not be considered an error. Talking about the estimates file, the project page says which suggests that there's no issue with a command appearing in the estimates file but not in the crontab file.

SVG not supported 6:27pm Thu 25th Aug, Simon E.

I'm not Chris but I may be able to help. From the task brief, it says that there won't be a command in the crontab that isn't in the estimates file. With a command that appears in the estimates file but not the crontab, I don't think it would be nece...

SVG not supported 4:24pm Thu 25th Aug, ANONYMOUS

Hi Chris, Just to clarify, if a command exists in the estimates file but not crontab, would that be considered a validation error? I am assuming that the inverse scenario where a command existing in crontab but not estimates would be an error due to la...

SVG not supported 2:42pm Thu 25th Aug, Cohen R.

When reading a file I have seen some places check for an EOF byte and some check for NULL byte. Are these the same thing and if not, what are the differences and which is preferred to use? Thank you

SVG not supported 11:26am Thu 25th Aug, Simon E.

Yes, and that the columns have correct values (i.e. a correct number of digits or characters)

SVG not supported 11:20am Thu 25th Aug, Christopher M.

Do you mean that the non-comment lines have the correct number of columns?

SVG not supported 11:18am Thu 25th Aug, Simon E.

I'm planning on using it to ensure the contents of the input files match a valid structure as stated in the outline. All my other interpreting of files I'm planning on doing manually

SVG not supported 11:11am Thu 25th Aug, Christopher M.

Hi Simon, Yes, you may use it, but I'd strongly encourage you to reconsider your approach - using regex for either the reading parsing of the 2 input files, or matching the 'current' date time against crontab entries is a huge overkill, and not a ver...

SVG not supported 10:43am Thu 25th Aug, Simon E.

Hi Are we allowed to use regex.h? It's not provided as part of ANSI C but is part of POSIX, which I'm assuming will be available if the project is compiled on a Linux system. Thanks

SVG not supported 5:09am Thu 25th Aug, Christopher M.

ANONYMOUS wrote It's a good question because it demonstrates the need for spending plenty of time designing your programs and their data well before you start coding (not suggesting that you're not doing that). Unsure if this helps, or if it's alread...

SVG not supported 7:56pm Wed 24th Aug, ANONYMOUS

Hello I was just wondering how should we go about finding the maximum number of commands running at a time. I can't seem to wrap my head around trying to find it (unless i'm thinking too much into it) Any hints would be great.. Thanks

SVG not supported 5:54pm Wed 24th Aug, Leo G.

That would be awesome, thank you Chris

SVG not supported 5:23pm Wed 24th Aug, Christopher M.

I'm currently working on a webpage to provide a sample solution; then you'll be able to upload any files, and see the sample's solutions for with those files.

SVG not supported 4:23pm Wed 24th Aug, Leo G.

Could we have the correct output for our program for these samples then? Everyone's logic can differ and it would greatly help if we could have one "sample solution" to base ourselves on.

SVG not supported 1:19pm Wed 24th Aug, Christopher M.

The project will only be tested on a computer with its year set in to 2022. However, it's not the best design to restrict (the code) of your project to only work in 2022, as it's easy to request the current date time (i.e. year) using standard librari...

SVG not supported 12:17pm Wed 24th Aug, Christopher M.

The project description says, report "the name of the most frequently executed command (a single word), the total number of commands invoked (a non-negative integer), and the maximum number of commands running at any time (a non-negative integer)."...

SVG not supported 12:14pm Wed 24th Aug, Connor G.

Is there anything else we have to do other than output the command name when simulating the execution? For example we wouldn't have to wait() right?

SVG not supported 10:58am Wed 24th Aug, Christopher M.

Hi Alicia, Yes. A pattern such as 1 1 32 7 is invalid because there are only 31 days in August. Yes, but the asterisk cannot every represent the 32, because it's not part of a valid date. It's not really a 'calendar system', and you don't need ...

SVG not supported 10:54am Wed 24th Aug, Christopher M.

Yes, that's how I interpret it. I think about the asterisks as wildcards, and effectively ignoring them, so the above matches any minute hour month when the 1st of the month is also a Monday. Unsure if the Clarifications page also answers this question ...

SVG not supported 10:19am Wed 24th Aug, Alicia L.

Hello Chris, adding on to the question recently asked by Ryan, I would like to know if you expect our program to check the calendar for valid dates. I'm concerned about this because of the asterisk, which basically takes in all the possible values of...

SVG not supported 10:00am Wed 24th Aug, Ryan W.

If the month is not specified, but the day of the week is, can the day of the month be specified? For instance 1 mon foo I intepret this as valid and meaning "run foo on every minute of every hour on the first day of each month if it's a mo...

SVG not supported 8:40am Wed 24th Aug, Taylah K.

Hey, There's a couple previous replies about this for other posts. We assume we're only working in 2022.

SVG not supported 5:58am Wed 24th Aug, Christopher M.

The project description provides a sample of one of each file; you can simply add or delete lines to your own copy of those. Start, for example, with a single line in a crontab file that runs a command just once per day, or every minute, etc. Print ...

SVG not supported 5:53am Wed 24th Aug, Christopher M.

ANONYMOUS wrote I honestly can't imagine what additional libraries you'd require for this project. What additional libraries functions were you thinking about? I've added a new point to the Requirements and fine-print section 13. Your project should ...

SVG not supported 5:50am Wed 24th Aug, Christopher M.

Please also read the (now numbered) section on Requirements and fine-print 8. Your project only needs to simulate the execution of processes for the requested month (of the current year). All processes will have terminated before the end of the req...

SVG not supported 1:19am Wed 24th Aug, Leo G.

Hi everyone, Can we find sample crontab and estimate files to, you know, create our program and test it? Cheers

SVG not supported 6:57pm Tue 23rd Aug, Benjamin C.

I read as an answer to another question, that "No process will execute beyond the month in which it starts, so a limit of 31 24 60 minutes."

SVG not supported 5:39pm Tue 23rd Aug, ANONYMOUS

Are we restricted with the use of libraries within the project?

SVG not supported 4:00pm Tue 23rd Aug, Zhuo H.

I wish to ask if the program will possibly face a command that starts from the previous month and continues to this month and it somehow forms the maximum number of commands running. And can we assume the year will be 2022 and 2022 only (cause we are ...

SVG not supported 2:48pm Tue 23rd Aug, Cohen R.

For the project 1 do we assume the current year is 2022 or do we have to find the current year?

SVG not supported 11:51am Tue 23rd Aug, Christopher M.

Just to clarify this, because someone asked. You may, of course, include the standard C header files in your code include stdio.h etc. There's no need to submit any standard header files for marking, because the marking environments will al...

SVG not supported 5:19am Tue 23rd Aug, Christopher M.

Someone sent these questions by email - please post here, rather than emailing them to me. You should assume that the 2 input files are created typed-in by humans, and humans often make mistakes. You should report as an error any non-comment line that ...

SVG not supported 4:19am Tue 23rd Aug, Christopher M.

Hi Taylah, Yes; I've added 'one-or-more whitespace characters....' to the project description. Once a line is determined to be a comment-line, the whole line is just ignored, so it has no expected layout. Similarly, the columns words fields in command...

SVG not supported 4:14am Tue 23rd Aug, Christopher M.

Hi Matthew, sorry, 'contradictory' was the wrong word. Using today's date, Tue 23rd August (2022) 1 1 23 7 2 - applies in 2022 (the 2 looks redundant but it documents the requirement) 1 1 23 7 tue - applies in 2022 (the tue looks redundant ...

SVG not supported 8:17pm Mon 22nd Aug, Taylah K.

Hi, I have a couple of small questions. 1. Can the values in the two files be separated by any number of white spaces? i.e. will the distance between the month and the day of the week and the command name remain the same? 2. On a similar note just wa...

SVG not supported 3:09pm Mon 22nd Aug, Christopher M.

Hi Alicia, After this morning's labs we made a few changes to the wording, so you may like to re-read parts of the page again. Files with zero lines should be permitted - they just indicate nothing to be done. No process will execute beyond the month i...

SVG not supported 3:03pm Mon 22nd Aug, Alicia L.

Hello, I would like to know regarding the specification of the most number of command lines to be contained in both crontab and estimates files, should we consider 0 command lines in the files too? And for the estimates file, should there be a limit f...

SVG not supported 1:39pm Mon 22nd Aug, Matthew C.

(politely) it is not obvious if this is contradictory. It could mean run only when the day of the month matches the day of the week in a given month, (which would be kind of obtuse imo), or it could mean run on every monday and run on every 13th of th...

SVG not supported 12:12pm Mon 22nd Aug, Christopher M.

(politely) this is something you should be able to reason about for yourself. You will need to handle contradictory data (as an error).

SVG not supported 12:04pm Mon 22nd Aug, Ryan W.

I just saw someone else ask the same question, feel free to ignore this one and answer them instead

SVG not supported 12:03pm Mon 22nd Aug, Ryan W.

What does it mean to specify the day of the month and the day of the week at the same time? In your example you show 0 10 22 7 mon deep-though the 22nd of August falls on a Monday, so it seems that this should only run on 22nd of August, in which ...

SVG not supported 11:55am Mon 22nd Aug, Matthew C.

By "the data itself" this includes that if it specifies the day of the month as a date, that there are enough days in the month (not worrying about leap years)? what is the behaviour if a day of the month and a day of the week is specified? does that...

SVG not supported 11:46am Mon 22nd Aug, Christopher M.

The files will not exceed the stated dimensions (number of lines, and width) - there is no need to check those. But you will need to check the format of non-comment lines, and the data itself.

SVG not supported 11:34am Mon 22nd Aug, Matthew C.

For the requirement to check for errors in the crontab-file and the estimate-file, are we guaranteed that "The crontab-file and the estimates-file will each contain at most 20 non-comment lines. Each line will be at most 100 characters long, and each ...

SVG not supported 6:41am Mon 22nd Aug, Christopher M.

The 1st project description is now available from https units CITS2002 projects project1.php Please post requests for clarification about any aspect of the project to help2002 so that all students may remain equally inform...

 UWA week 33 (2nd semester, week 4) ↓
SVG not supported 5:06am Tue 16th Aug, Christopher M.

ANONYMOUS wrote It's not an exact science, but hopefully this Friday afternoon, or Saturday.

SVG not supported 10:04pm Mon 15th Aug, ANONYMOUS

Hello, I was wondering which day the first project will be released? is it at the beginning of week 5? thank you

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  1:17AM Sep 14 2022
Privacy policy