Hi,
I was working in your code. And I must tell you I didn't understand
what you wanted to do. However, here, are discribe the steps you
must follow.
1. Create a file called StdAfx.h. And write into it, this...
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__080A3C04_6281_11D6_AEA2_008 0C8DFB15E__INCLUDED_)
#define AFX_STDAFX_H__080A3C04_6281_11D6_AEA2_0080C8DFB15E __INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444 553540000__INCLUDED_)
2. Create a file called main.cpp. And write into it, this...
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <tchar.h>
#include <wingdi.h>
#define MAX_SIZE 1024
#define NULL_LEN 1
using namespace std;
int main()
{
char Bitmap[MAX_SIZE + NULL_LEN];
//Write file To tmp or create tmp
FILE *Load = fopen("FASS.inv", "wb");
cout << "Enter the following information\n";
cout << "Bitmap: ";
//Open Directory
_TCHAR szFileTitle[MAX_PATH] = {0};
_TCHAR szTitle[MAX_PATH] = _TEXT("Open Dammit");
OPENFILENAME openfile;
memset(&openfile,0,sizeof(openfile));
openfile.lStructSize = sizeof(openfile);
openfile.lpstrTitle = szTitle;
openfile.Flags = OFN_FILEMUSTEXIST;
openfile.lpstrFile = szFileTitle;
openfile.nMaxFile = MAX_PATH;
openfile.lpstrFilter = ("Bitmap Files (*.bmp)\0*.bmp\0\0");
if(GetOpenFileName(&openfile) != FALSE)
{
//Read the open file
FILE *file = fopen(szFileTitle, "rb");
//Read from the open file and write to FASS.inv all the bitmap
while(!feof(file)){
fgets(Bitmap, MAX_SIZE, file);
fputs(Bitmap, Load);
}
fclose(file);
}
fclose(Load);
cout << endl << endl;
//Read tmp file
FILE *FASS = fopen("FASS.inv", "r+");
//Read from tmp file and assign data to Bitmap
fscanf(FASS, "%s\n", Bitmap);
//Print information
cout << "Information about the FASS";
cout << "\nName: " << szFileTitle;
cout << "\nBitmap: " << Bitmap;
fclose(FASS);
cout << endl;
return 0;
}
3. Put both files together in the same directory. And then run this
program.
Good luck!!!!!
|