satuation is ..... i've stored many mac addresses (one by one) in the buffer(*buff[]), now i want to extract the MAC addresses one by one and write it to a FILE seperated by COMMA in c.
HELP!!! THNXXX!!
satuation is ..... i've stored many mac addresses (one by one) in the buffer(*buff[]), now i want to extract the MAC addresses one by one and write it to a FILE seperated by COMMA in c.
HELP!!! THNXXX!!
If they're strings, you can just use something like:
FILE *fout = fopen ("output.txt", "w");
if (fout != NULL) {
char *sep = "";
for (int i = 0; i < sizeof (buff) / sizeof(*buff); i++) {
fprintf (fout, "%s%s", sep, buff[i]);
sep = ",";
}
fclose (fout);
}
If they're not strings, you should probably specify the data in greater detail. In any case, the logic is the same, the only thing that will change is the way in which you output the MAC address.
And if the array isn't full, then make sure you use a count variable to control the loop rather than the array size.