You may recognize it from my other post... I have, at this point, three such functions (and have to write many more). The ideais to pass the pointer to an array from one function ot the other, and print the contents of the array. This works with two of three functions (despite the warnings), but this one crashes the program.
Upon compilation, I receive the following warning: [Warning] initialization makes pointer from integer without a cast
I don't know exactly how I should cast here, and what exactly. If it's any help, I'm using Dev-C++ 4.9.9.2 with its standard compiler MingW32.
The only time you specify what you return is nested inside 2 if statements. Expanding on Grey Wolfs comments, you need to consider what gets returned in all the else cases.
Which line do you get the warning from?
The problem with indentation is that in the web form, tab does not work, and the computer I code on is not connected to the company intranet... I'll edit it in notepad before posting next time.
The warning happens on line 3 in the function writeBootup(). BUt the crashes are probably due to the undefined else statements (which actually should not happen due to pre-filtering, but obviously, they do... I'll look into it tomorrow).
A sidenote: the function type of getBootup() is void.
What are you calling function type? If it's the return type then you can't return anything.
The line 3 warning I would guess at being you passing linecount or count as integers when the prototype for writeAsText() is specifying a pointer to an integer.
BTW I use 4 spaces rather than tabs for indenting when posting code.
Silly me meant char and typed void... of course the function is initialized as char *getBootup(). It was/is implemented as char * in my program, so that is not the problem, I think.
Here's the function prototype of void writeAsText():
You should never ignore warnings, some of them can cause you big headaches further down the line.
I develop my code with warning set to the highest level, when I build a release I have warnings set to the highest level and "treat warning as errors" set. The aim is to get rid of all warnings, you may have to disable certain warning for parts of the code (usually third party/uneditable) or make minor changes to your code to make 'nuisance' warnings go away, but when that important warning pops up you will see it and deal with it before it causes you a problem.
My problem is, I can't seem to find what's causing the Warning, because I tried to make educated guesses to clear them, but I fear I just haven't understood how to correctly use pointers in their completeness, yet.
In the line if(((strBootup = strstr(buffer, "< 4444")) != NULL) && ((strEnd = strstr(buffer)) != NULL)){, you use strEnd = strstr(buffer) is this correct? I am not aware a strstr only taking a single parameter.