The purpose of the strncpy is supposedly to perform safe copies so as to not exceed the limits of your string sizes. The problem with the strncpy is that if your source string is longer than your...
Type: Posts; User: penney
The purpose of the strncpy is supposedly to perform safe copies so as to not exceed the limits of your string sizes. The problem with the strncpy is that if your source string is longer than your...
The reason for your error is because you are looping through current while there is a current. Therefore, it will be null after the loop finishes. You need to keep a pointer to the last thing prior...
Yes they are equivalent. But why are you casting anyway without an lvalue? Your variable is already a char * so no need to cast. Why not just do rtp++; and forget the cast. You would only want to...
Thank you!
I wrote some code in VB to send XML to a HTTP server. I am including that code below. I confess that I do not know C# but I have a customer who is asking if we would know how to do what I did in VB...
1st off I don't believe you are doing what you intend to be doing with your code. An array' name by itself is a pointer to the first location of the array. Therfore just do this:
ptrchar1 =...
Use the modulus operator - % and if the result is 0 then it's divisible by 3.
if( (num % 3)==0 ) /* Num is divisible by 3 */
Prior to using a pointer you should make sure that it is pointing to something and therefore is not NULL. Therefore, in your SetData routine place the following check:
if( temp ) /* It's pointing...
Your number array must be declared: int number[10];
Then you can check for positive and negatives like:
if( number[i] >= 0 ) /* Your number is positive */
/* sum up your pos total here */...
I am not sure of what you are trying to do. However, 1st off *ch = 0; will not set all 5 bytes to 0. I assume you are trying to set all bits in a char to 1 bit by bit. You could of course just assign...
If you had only passed a single pointer to the routine then the routine would have the address of the memory pointer only. By passing a double pointer you are getting the address of what the pointer...
You almost got it but you still did not fulfill the assignment by writing a createLine function: Here's a snippet of what I believe the teacher is asking for. Sorry for the late response - took the...
To make it work you have a number of options. The easiest route is to declare your input as: char input[N_STRINGS][25]; Now the scanf - You can change it to scanf("%s %s %s %s %s %s...
#1 First create a type called POINT. To create the POINT copy the LINE structure you show above and change the names etc. You should have int x; and int y; in the POINT structure.
#2 Declare two...
One thing you should do and this is probably causing the error. Check your index variable 'c' prior to storing to the x and y arrays and make sure it's between 0 and 99. Like so:
if( c >=0 && c <=...
Thank you Stack Overflow and CodePlug for your replies. I wasn't so much interested in a "fix" for the problem as much as I was a good explanation of the problem itself. I can easily fix the problem...
Looks good. You will then have to create a .c file that includes the header and then define a variable as one of those types... EMPDATA person; Which could be defined as an array or a pointer to some...
Please help me understand what's going on:
I have the following code and it does not appear to do rounding as I would expect it to:
double val=323.700000,rval;
double t=26.975;
int...
/*
I am attempting to print out a float without a leading zero if it's a
*/
float number = .2
/*
I thought just by specifying the following that this would take care of this:
*/
float...
The problem is that the enums are already existing in the other programs and they are a much larger structure than the one I provided. Ideally, I didn't want to have to move anything and would like...
My intent is to have one file which is shared across many applications. Ideally, I would like that file to reference the names and values within the enum which are defined in whichever program...
I created an enum in a file as follows:
enum {
SOME_VAL=201,
ANOTHER = 202
};
Thank you very much. I did realize that it throws away the last char unconditionally.
The whole reason I created the routine was because their were a million fprintf's in the program and I needed...
I have written the following code which accepts variable arguments:
void dprintf(FILE *fp,char *fmt,...)
{
char OldMsg[BUFSIZ];
va_list lArgs;
if(fmt && *fmt)
...
The other thing that you can do is use the keyword DISTINCT in your SQL SELECT statement.