cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Archicad C++ API
About Archicad add-on development using the C++ API.

Writing to a txt file in the Embedded Library

Rob C
Contributor

Hi all,

 

I've got a .txt file located within my Embedded Library, and I'm looking to write to it using an addon to allow some custom GDL objects to read it and update their parameters when they're placed. My question is whether this is possible at all? Current code is below:

 

 

API_LibPart settingsText = {};
GS::ucscpy(settingsText.file_UName, L("test.txt"));
ACAPI_LibraryPart_Search(&settingsText, false);
GS::UniString loc = "";
settingsText.location->ToPath(&loc);

/* GS::UniString out defined here */

std::ofstream file(loc.ToCStr().Get());
file << out.ToCStr().Get();
file.close();

 

 

I'm aware that this could be done using an addon with an event handler, though we've already got the objects currently reading this text file and we're concerned with the added processing time that might be required when placing a new object (though we're open to ideas to the contrary!).

 

Thanks,

Rob

0 REPLIES 0