View Single Post
  #1 (permalink)  
Old December 29th, 2004, 12:48 PM
ck ck is offline
Authorized User
 
Join Date: Dec 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pls Help Me Check This Code - Win32

hi,
 tis is the code that write/create, read the file in Win32.how can i put write code together with read code??? & how to get & display the bitmap pathname??? pls help me check what's wrong of this code, thanks a lot :(

code:

#include "stdafx.h"
#include "Finger_FASS.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// The one and only application object

CWinApp theApp;

using namespace std;

int main()
{

    char Name[10];
    char Bitmap[256];

    //Write File To tmp or Create tmp
    FILE *Load = fopen("FASS.inv", "w");

    cout << "Enter the following information\n";
    cout << "Name: "; gets(Name);

    //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");

    cout << "Bitmap: ";

    if(GetOpenFileName(&openfile) == FALSE)
    {
        gets(Bitmap);
    }

    fprintf(Load, "%s\n", Name);
    fprintf(Load, "%s\n", Bitmap);

    fclose(Load);

    cout << endl;
    return 0;


    //Read File From tmp
    FILE *FASS = fopen("FASS.inv", "r+");

    fscanf(FASS, "%s\n", Name);
    fscanf(FASS, "%s\n", Bitmap);

    cout << "Information about the FASS";
    cout << "\nName: " << Name;
    cout << "\nBitmap: " << Bitmap;

    fclose(FASS);

    cout << endl;
    return 0;

}



__________________
ck.
Reply With Quote