Open file text with Nodepad from Resources

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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#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:
1
2
3
4
5
6
#ifndef RESOURCE_H_INCLUDED
#define RESOURCE_H_INCLUDED
#define TEXTFILE 0
#define IDR_MYTEXTFILE 0

#endif // RESOURCE_H_INCLUDED 

Resource.rc:
1
2
3
#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
http://uploading.com/files/m595c2ec/MyProject.zip/
Last edited on
Extract it to a file, open the file in notepad, and then delete the file (notepad will still have the text from the file)
You're right! This is my problem. I don't know how to read Demo.text from EXE.
Demo.txt exists in EXE, because my program says: Found, so, Demo.txt exists, but I need to read / open it.
How to read file Demo.txt from EXE?
Topic archived. No new replies allowed.