Use strcpy to copy a string. Operator =
doesn't work for strings.
how to store the variable values in c program?
Domanda
KERNEL variables :
s32 remainder;
s64 quotient ;
How do you read the above variable values in a C program and store them in below variable?
uint32 InterruptLatency;
I am reading the time from kernel and it is off the type s32 and s64 as 1.3456;
how to read this on the user side program ??
uint32 InterruptLatency;
uint8 measurements[32];
char buf[256];
int kernelinterrupt time()
{
fscanf(fp, "%lu", &InterruptLatency); // I am reading the data from kernel which is not shown here
measurements[17] = InterrupLatency;
// after storing it in buffer I am sending the data from but to another layer
}
Is it possible read the variable values (s64 and s32) and store it in uint32 Interrup latency ??
Soluzione
Altri suggerimenti
Not entirely sure what you want to do here but using a union may get you somewhere.
typedef union
{
uint8 measurements[32];
char buf[256];
} measBuf;
measBuf myMeasBuf;
myMeasBuf.measurements[17] = InterrupLatency;
//send myMeasBuf.buf to somewhere
To be clear - using a union may not be what you want and yould be highly unstable since there is some system dependencie here. Also the sizes dont match the way that i have written it. In general unions may help you here but you have to see if you can make this work for your usecase.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow