The only thing I've found in scope of the .NET environment is that the KeyPreview property can be turned on to check keypresses before they are delivered to the focused control which limits this to...
Type: Posts; User: gwarf420
The only thing I've found in scope of the .NET environment is that the KeyPreview property can be turned on to check keypresses before they are delivered to the focused control which limits this to...
A part of one of my projects will require me to override the wndproc() function to catch a user-determined hot-key and right-click from an external application. I've been going through a couple...
Yes, but in explaining why char pointers should be declared const it should be natural to address the likely common question that "If I claim a char pointer as constant, it will not allow me to...
Why do you assign the address of the array instead of just "myArray"? Isn't "myArray" the same as "&myArray[0]"?
Apparently, you can only use pointer arithmetic if it is done normally: "int...
Why does K&R decide to go into the fact that
int (*intArray)[10] is a pointer to an int array yet does not show you how this syntax would be used? I've tried declaring it the natural way I would...
Thanks laserlight for the explanation. Your reasoning for using const for string constants was much better than the url wiki source given.
So is it not possible to initialize a pointer to an int...
That slipped by me. I initially was dealing with
int (*intArray)[4] = { 0, 1, 2, 3 } ; (which I still can't get to work) and decided to change the example to char at the last minute which...
*str == str[0]
Pointers point to the first element of an array. So when you dereferenced str you were assigning 'R' as the first element of the array.
printf prints all the characters in an...
Make the change suggested by Salem and you should no longer get the error. If the file doesn't exist it should print "Could not open file" to the screen.
Yes. When fopen goes to open the said file, if it does not exist, it returns the address of NULL instead of the address of said file (It doesn't exist). You cannot fclose (write and close) a file...
The sample code has an if statement that first checks to see if the file was able to be opened. The else statement only executes if the file was able to be opened. However, because the fclose...
I'm trying to solidify the concepts of various pointer types and I've run into a problem.
I know that I can initialize a pointer array (an array of pointers) with something like this:
char...
[QUOTE]
I just tried fgets(). Unfortunately, it has the same response to finding more input than specified. it just dies.[/QOUTE]
My bad, I was using a function that tested gets_s() and then...
Thanks, I'll make sure to free it and I see that it is not Null terminating the string also.
I just tried fgets(). Unfortunately, it has the same response to finding more input than specified. it...
so, the only check in the line "if (gets_s( buff, BUFFSIZE ) == NULL )" is to see if there is an absence of input in which the error is caught and handled. But does not check whether or not the...
so, the line "if (gets_s( buff, BUFFSIZE ) == NULL )" is not testing the return value of gets_s() but in fact testing to see if the buffer I specified was NULL? I'm sorry but that doesn't make sense...
In the secure coding article at buildinsecurity.us-cert.gov what is the purpose of the following code if it is only going to bomb out before the exception can be handled?
if (gets_s(buff,...
so, because every modern OS has memory protection, using gets() throws a fault and doesn't continue just like gets_s. Why should I go through the trouble of using these supposedly more robust/secure...
I see now, it had ISO/IEC 99 as a reference as well simply because it was talking about current standard functions as well as ISO/IEC WDTR 24731 (Secure C Library).
So the VC++ implementation of...
As for ISO definition of gets_s, I got my information from this site: buildsecurityin.us-cert.gov
As far as I can tell from the explanation of the gets_s function, explained in the link above, ...
gets_s is defined in ISO/IEC 99 maybe that is why it is not in other compilers?
but for VC++ my code looks like this:
#include <stdio.h>
int main ( int argc, char *argv[] )
{
char...
I don't know why I can't get this function to work, but I've spent all day and all night searching and have found nothing but problems. gets_s(buffer, size) is supposed to be a more direct, more...