Well, it's been a long time since I used VC++ and I started again in December. Now, I have made a little "encryption" program using the Julius Ceasar algorithm in VC++ and I added a Tip of the Day component when the program starts.
The thing is that this component is relying on a file called Tips.txt but what I want to know, is ...
Is there a way to get rid of the tips.txt and somehow make the component look for the tips internally (you know, so I don't have to pack the exe with a txt file)?
P.S. if you want to see the executable and test it a little, just post and I might be able to put it up for download :P
Resources are more flexible and can be changed without a recompile or stored in seperate DLL's.
I was suggesting that you put the entire contents of the file into a single array. Consider that if the file is small and you have no need to modify the data once the code is built. Upside is that it's a quick and easy way to get the text "inside" the exe.
If I choose to go the Resource route, whatever I put there (let's say I called the ID -> IDS_TIP and put whatever text) it's going to be a structure type or something similar while the Tip of the Day function uses a String variable.
Do you have an example to pass the IDS_TIP to the string variable?
Also, can you provide an code example of the array you are suggesting? (I'm only going to use one tip so ...).
Well.. it seems that functions requires an Instance and I'm not using API I'm using MFC.
So I tried changing a created variable (the component created it) that opens the file tips.txt to a CString so I could do:
but it gives me errors (since the rest of the component thinks I'm opening a file!). If I take out everything related to file manipulation, the program compiles but when it is time to execute it just gives me a fatal error (still can't find it!!!).