Hello,
In C, is it possible to serialize a buffer, and save the buffer in a file like in java ? and how ?
Thank you so much.
Hello,
In C, is it possible to serialize a buffer, and save the buffer in a file like in java ? and how ?
Thank you so much.
Java is implemented in C++, so the answer to your question is, "yes, it's possible." The how depends on the particulars which you have not specified.
Regards,
Alister
My probl�me is: i have written a client and a server in C, the client send a char to the server (for example "A") the server increments and send the char "B" to the client etc...
i'd like to:
save the last char received by the client and by the server , for a new connection between them they get the char fom file and continue
is that possible ?
Write it to a file.
Then read the file back.
It's just an array of bytes.
with fwrite() ?
Thank you.
There are many methods available.
#include <stdio.h>
int main(void)
{
char buf[8];
FILE *fp=fopen("filename", "rb");
if(fp == NULL)
return(1);
// read 8 bytes into buf
fread(buf, 8, 1, fp);
fclose(fp);
}