Author Topic: Open file text with Nodepad from Resources  (Read 3828 times)

diana_pro

  • Guest
Open file text with Nodepad from Resources
« on: August 03, 2011, 07:55:28 am »
HI,
I started to play with files in C++ and I have a little problem.
Here is my c++ project and the problem:
main.cpp
Code
#include <iostream>
#include "resource.h"
#include <windows.h>
#include <stdio.h>
#include <fstream>

using namespace std;

int main()
{
    HRSRC hRsrc;
    hRsrc = FindResource(NULL, MAKEINTRESOURCE(IDR_MYTEXTFILE), TEXTFILE);
    if (hRsrc == NULL) {
        printf("Not found\n");
    } else {
        printf("Found\n");
    }
    //system("notepad " + myfile);
    return 0;
}
resource.h:
Code
#ifndef RESOURCE_H_INCLUDED
#define RESOURCE_H_INCLUDED
#define TEXTFILE 0
#define IDR_MYTEXTFILE 0

#endif // RESOURCE_H_INCLUDED
Resource.rc:
Code
#include "resource.h"

IDR_MYTEXTFILE TEXTFILE "Demo.txt"
Now it's time to explain my problem:
I want to run Demo.txt with Nodepad using "system("notepad " + myfile_Demo.txt);"
I don't know where is Demo.txt from Resources and How can I open it.
I use Code::Blocks - Download the c++ files from end of message.
I appreciate any suggestions.
Best regards,
Diana
« Last Edit: August 03, 2011, 07:57:51 am by diana_pro »