Hi Chris,
Hope you had a great morning. I was wondering whether we should know pthread types and pthread functions for tomorrow's exam since they were taught in the last few lectures of this semester? There's quite a bit to understand and implement i...
Hi Chris, could you please help me with this error message when compiling one of my source code files? This is the message
"Undefined symbols for architecture x86 64
" main", referenced from
implicit entry start for main executable
ld symbol(s...
Thank you for elaborating. Now, I'm just stumped with the method of removing these references. I'm thinking about reading in the trove-file, checking whether the filename(s) are found within the file and overwriting it, but I'm still not sure.
Would ...
Hi, regarding project 2's command line options would '-r' involve reading in the trovefile, checking whether the filename (from the filelist) is found within the trovefile and remove that particular line?
With '-u', would we open a new trovefile, co...
Hi, I'm having trouble indexing all the words in a file, line-per-line if the length of each line is unknown. People have suggested realloc() and malloc() but you would need to know the length of a line to use them, so I'm hitting a wall at this stag...
Hi Chris,
Regarding what you said about the trove-file do we 'input' the real pathnames of the relevant files into a trove-file and return the contents of this trove-file? The project description says
"the filenames stored in the trove-file should b...
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?
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...
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...
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...
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...
ANONYMOUS wrote
Oh, I've managed to return the string by declaring a pointer for the value of variable 'command' char command "m". Cheers for your time.
Hi, yes thanks for the clarification. The top command is one of the values, which could be a sequence of characters, that we should be returning for Project 1 2022. If we were to create a function to return this value, what would the function declara...
To return the top command, should the function's header be 'char my function()' or 'const char ' (suggested by Google)? The compiler returns "address of stack memory associated with local variable 'command' returned..." when returning "m" for testin...
Regarding this , I have a function that checks if the month crontab value is an actual value, such that given a string, if the characters of this string are digits - convert to an int, but if the characters are letters, then check if the string matc...
Thanks for the reply. I'm looking to check if the 'word' is an asterisk, and if it is, then 'convert' it to an int such as -1 for future use and storage.
For example, I'm printing the minute and hour values but since the first two lines of the crontab files are ' ', my functions aren't returning -1. I've made sure to check if the string is an ' ' and if so, return an int. I've tried placing the condit...
This is probably a really simple solution (and silly question) but how do we convert a char symbol to an int? I want to check if the given string is a symbol before returning an int value that's associated with that symbol but when I print the values...
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.
Yes, this makes sense. I'll be using my own functions now which will convert each valid sequence of chars to its designated int value before storing it into an array of structs.
To account for ' ' values, I was thinking of assigning the maximum value to it, such as for minute, hour, day of month, month and day of week 59, 23, 31, 11 and 6. But then they would actually be read as what they are, not for every value of that mo...
As the file values are written as strings, how do we convert these values to an int for our struct? I tried using sscanf and storing the formatted values in int values but there's a mismatch error.
For example, sscanf(" s", atoi(minute)); doesn't wor...
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...
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(), ...
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 ...
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...
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...
That clears it up, thanks. I've tried my files using the sample solution but it returns " '' is an invalid minute" when all my minute values are valid values - no minute value is missing. I suppose I'd have to try again.
Hello When we read the crontab file execution times (expressions), how do we relay this information to the system and what do we do with the estimates time information? I get how to store the data but am unsure of the 'linking' process of timing the...
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.
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 ...
Hi, I was wondering how we can read into any file, given that we don't have that particular file stored in our local computer. For example, when marking our source code, how would our work read the given sample data? This is what I'm still confused a...
Hi, I'm getting this error when it comes to compiling
"Undefined symbols for architecture x86 64
" main", referenced from
implicit entry start for main executable
ld symbol(s) not found for architecture x86 64
clang error linker command faile...