Not really, apart from allowing you to find 'binary' keys too.
I tried to write a routine that shows you how it would work. memcmp() works fine too. I was under the impression I could make it a...
Type: Posts; User: Lord Thunder
Not really, apart from allowing you to find 'binary' keys too.
I tried to write a routine that shows you how it would work. memcmp() works fine too. I was under the impression I could make it a...
You're welcome ;)
I think quzah explained the ASCII vs binary bit quite okay. As for your routine: it will work, but please note that strlen() also assumes a ASCIIZ string and will give you the...
If you cared to read the initial post, it says his assignment requires him to compile with -ansi, which means his teacher wants them to write ANSI-C code only, not C99.
LT
No, the variable space is allocated only once the before/at the start of the loop, the only difference is that any variable you may declare inside a block, cannot be used outside of the block.
In...
I would use a switch statement in teh function instead of a battery of else-if constructs.
Actually, a common solution to this is not to make a function at all, but a constant map. It's faster,...
This is true, but then you also have to remember that you are not allowed to use that variable anywhere outside that block. (I cannot think of a sane piece of code where that would be a problem, but...
{
printf("Please enter the filename for the text file to process, or enter -h for help. Press Enter to exit: ");
fgets( inputBuffer, sizeof(inputBuffer), stdin);
char *newline =...
I have read (some of) Wirth's books, he likes to use simplified versions of IBM's PL/1 and (in his later books) Oberon, which he created. Both look similar to Pascal at a glance.
Offtopic: His...
There .. fixed.
You don't even have a compiler, do you?
LT
Why bother with short source code? Your compiler will just give you a hard time (spamming warnings) and then (hopefully) compile it to the same machine code anyway. What you should really be looking...
I think the problem has little to do with the type of the array. I think your code should work.
The problem lies with your use of strstr(). The strstr() function expects a so-called ASCIIZ string....
Sorry if I am a topic digging here, but I came across this thread while searching for the answer for exactly this problem and I noticed noone here gave the right answer.
The answer turned out...