L
Laco
Dear All,
I have some C++ code which is autogenerated and reads data from a file
(numeric values). This external data file "Weights.asc" is not big
(11kb).
The rest of the code is expecting a passed FILE* pointer in order to
read properly the numeric values and compute stuff. This is real-time
application and thus reading / writing files is strongly prohibited and
time expensive.
The data I have is of the correct type but it is in memory. Is there a
way I can create a FILE structure and point it to the data in memory,
or generally convert my in memory data to a FILE structure?
Here is a part of the code:
FILE *loadStream = fopen("Weights.asc","r");
// Get the file version number
weightFileVersion = getWeightFileVersion(loadStream);
// Load Normalization Coefficients
inputFile.loadWeights(seekComponent(loadStream, "File",
"inputFile"),weightFileVersion);
ComputedOutput.loadWeights(seekComponent loadStream, "DataStorage",
"ComputedOutput"),weightFileVersion);
// Load A Weights
inputAxon.loadWeights(seekComponent(loadStream, "Axon",
"inputAxon"),weightFileVersion);
hidden1Axon.loadWeights(seekComponent(loadStream, "TanhAxon",
"hidden1Axon"),weightFileVersion);
outputAxon.loadWeights(seekComponent(loadStream, "LinearAxon",
"outputAxon"),weightFileVersion);
// Load S Weights
hidden1Synapse.loadWeights(seekComponent loadStream, "FullSynapse",
"hidden1Synapse"),weightFileVersion);
outputSynapse.loadWeights(seekComponent loadStream, "FullSynapse",
"outputSynapse"),weightFileVersion);
fclose(loadStream);
My question is whether I can use STRINGSTREAM to make a string variable
with the complete data in the memory and then use the pointer to the
data to execute the rest of the code.
Thank you for your help.
Laco.
I have some C++ code which is autogenerated and reads data from a file
(numeric values). This external data file "Weights.asc" is not big
(11kb).
The rest of the code is expecting a passed FILE* pointer in order to
read properly the numeric values and compute stuff. This is real-time
application and thus reading / writing files is strongly prohibited and
time expensive.
The data I have is of the correct type but it is in memory. Is there a
way I can create a FILE structure and point it to the data in memory,
or generally convert my in memory data to a FILE structure?
Here is a part of the code:
FILE *loadStream = fopen("Weights.asc","r");
// Get the file version number
weightFileVersion = getWeightFileVersion(loadStream);
// Load Normalization Coefficients
inputFile.loadWeights(seekComponent(loadStream, "File",
"inputFile"),weightFileVersion);
ComputedOutput.loadWeights(seekComponent loadStream, "DataStorage",
"ComputedOutput"),weightFileVersion);
// Load A Weights
inputAxon.loadWeights(seekComponent(loadStream, "Axon",
"inputAxon"),weightFileVersion);
hidden1Axon.loadWeights(seekComponent(loadStream, "TanhAxon",
"hidden1Axon"),weightFileVersion);
outputAxon.loadWeights(seekComponent(loadStream, "LinearAxon",
"outputAxon"),weightFileVersion);
// Load S Weights
hidden1Synapse.loadWeights(seekComponent loadStream, "FullSynapse",
"hidden1Synapse"),weightFileVersion);
outputSynapse.loadWeights(seekComponent loadStream, "FullSynapse",
"outputSynapse"),weightFileVersion);
fclose(loadStream);
My question is whether I can use STRINGSTREAM to make a string variable
with the complete data in the memory and then use the pointer to the
data to execute the rest of the code.
Thank you for your help.
Laco.