Hi all,

Im using MFC to create my application and im stuck with the whole 'save as' function.

Im stuck with renaming an existing file to what the user keyed in the dialog box of 'save as'.

for example i got a file new.bmp.
so after editing the image and all that, the user wants to save it as 'john'
i already have this code:

(FileSavedlg.DoModal() == IDOK) {
pen = false;
man_segment_select = false; //Don't set the flag for Selecting region manually for Segmentation
const size_t StringSize = 100;
size_t CharactersConverted = 0;
char filename[StringSize];
wcstombs_s(&CharactersConverted, filename, FileSavedlg.GetFileName().GetLength()+1, FileSavedlg.GetFileName(), _TRUNCATE);
if ((err = fopen_s(&fs, filename, "wb+")) != 0) {
printf("Cannot open binary file. ");
when i do this: rename(new.bmp, filename);
it gives me a filename called 'filename' with an unknown type of file but with the same size as 'new.bmp'. and then there's another file called john in BMP format BUT its empty. why is this so? where have i go wrong in this? if u need my full codes for the 'save as' function pls do let me know. help will be appreciated.

Last edited by metamofia; 20Nov2009 at 07:26..