News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Open file text with Nodepad from Resources

Started by diana_pro, August 03, 2011, 07:55:28 AM

Previous topic - Next topic

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
#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:
#ifndef RESOURCE_H_INCLUDED
#define RESOURCE_H_INCLUDED
#define TEXTFILE 0
#define IDR_MYTEXTFILE 0

#endif // RESOURCE_H_INCLUDED

Resource.rc:
#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