i have to go through one big file that contains code written in capl and there are function hwo don't have any returning type and i have to put void before function's name. any idea??? please :D
but there are more then one functions like this....is a file with 22000 code lines and i don't know how many functions and what function don't have returning type !!
i know that
maybe i wasn't so explicit
i have to write a code to go through this file (this file contains code written in CAPL) and where i found a function without returning type i have to put void. my problem is i don't know where to stop getting characters from file, where are this functions who don't have returning type, and i also don't know the functions name.
there are MANY functions without retuning type!!!!maybe 600...i don't know...
Well first you have to be able to identify different functions.
Check for the characters { and }. If you count that there are no more open brackets and they have all been closed, then you've found the end of a function. Keep track of that line number or something.
Now that you've found where all of your functions are, look for the keyword return and check if there is a ; after it or if the next non-blank character is something other than void. If this is the case, then you probably do not have a void function.
Now we've identified where the functions are and which ones are not void. Now you can write something to go on there and add the keyword void to the start of each void function (or at the end of the function before the void one).