I'm trying to output a bunch of variables to a file, with 2 numbers and a carriage return on each line.
I have two global int arrays declared all with variables in them.
void FileOutput()
{
FILE *f = fopen ("myfile.txt", "wb");
if (f == NULL) die("Couldn't open myfile.txt for writing, sorry");
else {
int x;
char temp_string[20];
for (x = 0; x <= 4; x++)
{
sprintf(temp_string, "%i %i \n", x_pos[x], y_pos[x]);
//printf("%i %i", x_pos[0], y_pos[0]);
printf("Calm down sir, PLEASE\n");
fputs (temp_string, f);
}
fclose(f);
}
printf("Don't worry sir, I'm from the internet\n");
}
Now, it puts it in the file fine, however, it all comes out as one line. The output on the screen comes out fine and I get carriage returns as expected there, however. I'd like it to come out this like this:
82 103
49 134
953 535
354 53
3535 234
The variables are purely aribtrary, this is an extension of a tutorial I'm following (I'm doing Wii homebrew development). I have to say, I've been doing programming for a while, and yet, I've never come across an issue quite like this that I haven't been able to resolve so easily.
Shoving \n everywhere does nothing (in regards to file output). I've tried injecting it when doing fputs() and also at the sprintf part, neither work. Honestly running out of ideas here. Anyone able to give me a hand figuring out what I'm doing wrong here?
They are neither of those things
They cause virtually zero issues to end users as when leveraged correctly they are invisible.
They aren't 'DRM', because, they're nothing to do with DigitalRightsManagement
Some Anti-Cheat services I did see are starting to *use* the TPM to store creds/tokens, which it's for, but it's not involved beyond that.
I would suggest doing some reading, both articles are fairly lengthy, but for MS Learn they're actually pretty decent at explaining the concepts.
SecureBoot
https://learn.microsoft.com/en...ystem-security/trusted-boot
TPM
https://learn.microsoft.com/en-us/windows/security/hardware-security/tpm/trusted-platform-module-overview
Cybersecurity in the modern world is all about defence in depth, and these are two of the layers of the security onion
Question
The Teej
Okay, it's 2am, and I'm at my wits end.
I'm trying to output a bunch of variables to a file, with 2 numbers and a carriage return on each line.
I have two global int arrays declared all with variables in them.
void FileOutput() { FILE *f = fopen ("myfile.txt", "wb"); if (f == NULL) die("Couldn't open myfile.txt for writing, sorry"); else { int x; char temp_string[20]; for (x = 0; x <= 4; x++) { sprintf(temp_string, "%i %i \n", x_pos[x], y_pos[x]); //printf("%i %i", x_pos[0], y_pos[0]); printf("Calm down sir, PLEASE\n"); fputs (temp_string, f); } fclose(f); } printf("Don't worry sir, I'm from the internet\n"); }Now, it puts it in the file fine, however, it all comes out as one line. The output on the screen comes out fine and I get carriage returns as expected there, however. I'd like it to come out this like this:
82 103
49 134
953 535
354 53
3535 234
The variables are purely aribtrary, this is an extension of a tutorial I'm following (I'm doing Wii homebrew development). I have to say, I've been doing programming for a while, and yet, I've never come across an issue quite like this that I haven't been able to resolve so easily.
Shoving \n everywhere does nothing (in regards to file output). I've tried injecting it when doing fputs() and also at the sprintf part, neither work. Honestly running out of ideas here. Anyone able to give me a hand figuring out what I'm doing wrong here?
Major thanks in advance.
Link to comment
https://www.neowin.net/forum/topic/997904-c-carriage-return-with-fputs/Share on other sites
14 answers to this question
Recommended Posts