User forums > Using Code::Blocks

Open file text with Nodepad from Resources

(1/1)

diana_pro:
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;
}

--- End code ---
resource.h:

--- Code: ---#ifndef RESOURCE_H_INCLUDED
#define RESOURCE_H_INCLUDED
#define TEXTFILE 0
#define IDR_MYTEXTFILE 0

#endif // RESOURCE_H_INCLUDED
--- End code ---
Resource.rc:

--- Code: ---#include "resource.h"

IDR_MYTEXTFILE TEXTFILE "Demo.txt"
--- End code ---
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

Navigation

[0] Message Index

Go to full version