Hi again, I'm trying to make a program that converts a bit map into an array and then writes it to a header file so i can include it into a program for the DS. One i know there's a program that does something like this for you but i would rather make one myself,
two I have exhausted all means of trying to get this program TO NOT print two #endif 's in the file. I have a for loop that writes the info my convertfunction gives it then after the for loop it writes the array --
char arr[]="#ifndef FUNCTIONS_H_INCLUDED\n#define FUNCTIONS_H_INCLUDED\nbmparray={\n\0";(i've also tried w/out the \0 just incase)
problem is it writes this before the for loop executes then writes the stuff in the for loop and then writes it again at the end of the file like its supposed to. I am using fwrite() for all my writing parts if any one has some insight it would be helpful!
I'm 99.9999% positive ....
It's out side the for loop and any other loop
There is only one fwrite that writes arr to the file
It writes it flawlessly each time but it writes it twice which just confuses the heck outa me
I just don't know
I am 99.9999% sure of this because i've looked at it when i was well rested,fed and in a good state of mind, i've also re read my code over and over and over for a while now and still have absolutely no idea(it may even be something verry simple i have over looked somehow that i dont know about the fwrite() function which im looking into), again any insight will be appreciated!
two I have exhausted all means of trying to get this program TO NOT print two #endif 's in the file. I have a for loop that writes the info my convertfunction gives it then after the for loop it writes the array --
char arr[]="#ifndef FUNCTIONS_H_INCLUDED\n#define FUNCTIONS_H_INCLUDED\nbmparray={\n\0";(i've also tried w/out the \0 just incase)
problem is it writes this before the for loop executes then writes the stuff in the for loop and then writes it again at the end of the file like its supposed to. I am using fwrite() for all my writing parts if any one has some insight it would be helpful!
I'm 99.9999% positive ....
It's out side the for loop and any other loop
There is only one fwrite that writes arr to the file
It writes it flawlessly each time but it writes it twice which just confuses the heck outa me
I just don't know
I am 99.9999% sure of this because i've looked at it when i was well rested,fed and in a good state of mind, i've also re read my code over and over and over for a while now and still have absolutely no idea(it may even be something verry simple i have over looked somehow that i dont know about the fwrite() function which im looking into), again any insight will be appreciated!