If I'm printing a hex value ala...
printf("%x", number)
and it only turns out to be anything from 0 to F, how can I force a leading 0?
So it gets printed out as 09, 0F etc.
So it's...
Type: Posts; User: Evenstevens
If I'm printing a hex value ala...
printf("%x", number)
and it only turns out to be anything from 0 to F, how can I force a leading 0?
So it gets printed out as 09, 0F etc.
So it's...
Cheers, that was just what I needed :)
I have a bunch of variable strings and was wondering if there was a quicker/easier way of sticking them all together into one big string other than with strcat(a, strcat(b, strcat(c,d))))
I figured it out. It was just putting carriage returns ('\r') at the end of each line rather than '\n'
Rather annoying.
Does copying and pasting put a different character code at the ends of lines or something? like '\0' instead of '\n'?
...not entirely sure...
I have a program which takes in a text file and processes what's in there etc. It's the text file I've used with all my tests, I've edited it to test whatever circumstances...
Gotchya, cheers.
Sorry...i don't quite understand what's going on there :-\
The numbers are in character format so reading an integer wouldn't quite work would it?
As x,y or z could be 3, 15 and 2318493, for example.
Say I have a string in the format "&x,&y,&z", is there a quicker way of validating it for 'correctness'
I'm trying to make a program which accepts the string in that format (Ampersand, integer of...
Hmm, I've had a shot but with no success -
Is there a way to convert your way of separating strings into something with a 2D array, as I need to reference specific characters in the string later...
Oh, nevermind, I fixed it.
I copied your code into a test program just to see what happened and it seg faulted...
I tracked it down to the while loop test but can't seem to fix it :-\
Say I'm strtoking a string that is in the format
a:b:c:d:e:f:g
And I want a,b,c,d,e,f and g to go into arrays made for them
i.e.
array[0] would contain a
array[1] would contain b...
Okay, so basically I have an instruction table which looks like this to work from:
http://i40.tinypic.com/s2e5q1.jpg
Are you saying I make an enum with every "instruction" in it?
i.e.
...
Therein lies the problem though. There's like...30 different "types" of instruction. So I have no idea at what angle to come at this from.
Seriously stuck here
I have to build an assembler and I'm getting stuck on the first bit :-(
I need to read each line of the input file. i.e
loop:
add $1,$1,$1
b loop
Cheers, the strtok method worked really well for what I wanted :-)
Really fast replies as well.
Maz, I tried a method similar but it just completely failed. I got in a jumble with myself so...
Lets say I have input of "Oh my god I like pies" or something equally ridiculous, I'm having trouble getting this into multiple character arrays so that it's like...
Array 1 is Oh
Array 2 is my...