![]() |
STRCAT problem
Hi!
I wanted to thank you a lot for the help given yesterday... It`s so great to have people so well prepared trying to help you! I have another problem: the bold line : strcat want a pointer as argument, but probably i'm mistaking it ... can anybody help me? Code:
#include <stdio.h> |
Re: STRCAT problem
ip is a pointer to a char, not to an array of char (a string), as required by strcat.
You also have a potentially bad issue: unless you have a C99 compliant C compiler, you'll have problems if you declare variables down in the body of the code. For C code, put all your declarations at the top, before any runtime statements. Even if your compiler tolerates it, it isn't portable code. If you're writing C and compiling it as C++, that's not a Good Thang. On the issue of formatting, please put your code in code tags, hereafter. Read the "Before you make a query" thread. I'd also recommend paying a little more attention to your formatting. Be consistent with your indentation. If you're planning on being a professional, someone else is going to wind up maintaining your code. They might be big, muscular, and mean. |
Re: STRCAT problem
Thanks for your advices DaWei!
I will remember them! :) Is it possible to concatenate just an int to the char filename? In that case I would be safe... |
Re: STRCAT problem
I got it...
I can use sprintf PHP Code:
|
Re: STRCAT problem
Just as a reminder, move the red statements to where shown in blue. This is a scoping issue that will affect portability of C code. It's great in C++.
Code:
main () |
Re: STRCAT problem
Good to know!
:) |
| All times are GMT +5.5. The time now is 20:41. |