I am new in either c , and c builder(11 v-28), i have put in ressources a text file(via projet->Ressources and Images), but i can't find any method to retrieve my text from ressources, LoadStr(..) function reclaim a numeric identifier that i can't found or how to get it.
CodePudding user response:
Using C Builder you can use functions in the RTL to help you.
When you put the large text file into the resources you would have given it a type and Id. Normally for an embedded file the type would by RT_RCDATA.
(I haven't checked this code at all so it probably won't compile, but should give you a pointer)
TStream * function TMyForm::GetResourceStream(UnicodeString szResName);
{
TStream: rc;
id: int;
rc=nil;
id=StrToIntDef(szResName, 0);
if(id > 0)
{
rc = TResourceStream::CreateFromID(hInstance, id, RT_RCDATA);
}
return(rc);
}
Th hInstance is the Instance of your program that is passed to WinMain.
Once you have the TStream
you can read from it. You could populate a TStringList for example.