IMPORTANT: The following journal is intended for the use and viewing of approved persons only and may contain information that is confidential, privileged or unsuitable for overly sensitive persons with low self-esteem, no sense of humour or irrational religious beliefs. Any dissemination, distribution or copying of this work is not authorised (either explicitly or implicitly) and constitutes an irritating social faux pas. Unless the word ‘absquatulation’ has been used in its correct context somewhere other than in this warning, it does not have any legal or grammatical use and may be ignored. No animals were harmed in the creation of this journal and a minimum of Microsoft software was used. Those of you with an overwhelming fear of the unknown will be gratified to learn that there is no hidden message revealed by reading this warning backwards.

Year View| Summary| Highlights| Month View| Sunday 18 April 2004 (Day View)

18.04.2004Sunday 18 April – Lazy

I slept in terribly late again, which doesn’t make me feel that well when I do finally wake up – although I did wake having a nice dream. I then diddled around fixing up and testing my assignment code – it’s all done I reckon, although I’ll test it further at uni tomorrow. I’m a bit hesitant to change it anyway, as it has become a bit complex and doing stuff has weird and unusual results in different parts of the code that are beyond my level of understanding.
It’s just after midnight, and I’ve packed ready for uni tomorrow. I plan to go in a bit earlier than I need, and print out whatever I’m lacking, so I can actually get a grip on things. I’ve several assignments’ due dates looming, and a mid-semester exam, so I think it’s high time I get serious about actually learning what I need to know to pass these things.
From a post I made to the “Systems Interface Programming” newsgroup, explaining why I used an array of char, rather than something else, for my assignment:
  “I do not know C, yet I have to produce a program within a short period of time so the least I can learn to do this, the more chance I have of successfully completing it. The lower I can get the learning curve, the more likely I’ll be able to climb it within two weeks. So, based on this logic, from our previous assignment, I know that a char equals a byte, that an array of chars is a “string”, and that I can pass arrays of chars around (or at least pointers to them), which is the same as passing arrays of bytes around. I needed a way of holding and passing around a 5 byte “key”, so an array of 5 bytes seemed the logical way to do this, hence the array of chars.
  Everything in my assignment is char (byte) based, I read one char (byte) at a time, XOR it with one char (byte) of my array of chars (bytes) “key”, and write the resulting one char (byte) back to an output file. To make the key I request a five char (bytes) “string” from the user, split this into a series of two char (byte) “strings”, and convert each two char (byte) “string” into one char (byte) and store that in my five char (byte) key. Add a little bit of file selection and so on (which is all just reading in arrays of chars (bytes) from the user and doing stuff with them) and it’s done. Doing it this way meant there was nothing particularly new that I had to learn. The only real learning curve I had was fixing the stupid pointers and memory issues I had and ensuring no string functions were used on something that could contain a string terminator in the middle. I’m sure there’s many better ways to do it, but I managed to do it using only my existing vague knowledge of arrays of chars (bytes) and avoided using any malloc’s, calloc’s, bitwise operators, or other new and nasty things, and thus reduced my learning curve – and will (hopefully) pass.

Add your comments

You may leave a short comment, not longer than 800 characters.

Be Amused

Printed on 100% recycled electrons
W3C CSS 2.0