It's UWAweek 48

help2002

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 the 2 articles in this topic
Showing 2 of 919 articles.
Currently 4 other people reading this forum.


 UWA week 37 (2nd semester, week 7) ↓
SVG not supported

Login to reply

👍?
helpful
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 believe the difference to be that one of the values has a null byte at the end of a command and the other does not. How can I go about fixing this? Do I try to append a null byte to the string and how could I do this? Thanks


SVG not supported

Login to reply

👍?
helpful
11:44am Wed 14th Sep, Christopher M.

ANONYMOUS wrote:
> 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 believe the difference to be that one of the values has a null byte at the end of a command and the other does not.
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, did you remove, or allow for, the newline character at the end of each line read?

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