- 0
[C++] carriage return with fputs()?
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Posts
-
By freedonX · Posted
When I was a teen, I actually believed that the government used to be always be the bad guy. However as an adult, someone who has actually seen the Law work (though not perfect). I now think everyone cries a river. In this specific case, the so called freedom has consequences to society. Anyone who has seen how child are indeed affected, and I don't mean only extreme things like getting drugs or hate crimen , but no one can deny society as a whole has gone down a rabbit hole due to exesive use of internet. Before anyone calls out that it's the parents responsibility. Yes that's true, but the reality your family/kids might be good people. There are 99% out there who are not and have been brain dead by many things on the internet. -
By Mighty Pen · Posted
Siri AI : iPhone Air, iPhone 17 Pro iPad with M4 and later with 12GB or more in memory Mac with M3 and later with 12GB or more in memory -
By Mighty Pen · Posted
Siri AI will only work locally on these new machines. Not great iPhone Air, iPhone 17 Pro iPad with M4 and later with 12GB or more in memory Mac with M3 and later with 12GB or more in memory -
By Copernic · Posted
Universal Media Server 15.6.0 by Razvan Serea Universal Media Server is a DLNA-compliant UPnP Media Server. UMS was started by SubJunk, an official developer of PMS, in order to ensure greater stability and file-compatibility. The program streams or transcodes many different media formats with little or no configuration. It is powered by MEncoder, FFmpeg, tsMuxeR, AviSynth, MediaInfo and more, which combine to offer support for a wide range of media formats. Because it is written in Java, Universal Media Server supports all major operating systems, with versions for Windows, Linux and Mac OS X. To see a comparison of popular media servers, click here. Universal Media Server 15.6.0 changelog: General Added Discogs integration for audio metadata and UPnP Added new options for DNS resolution handling (thanks, @henry701 Henrique Campos!) Added a loading indicator to the Shared Content area on the web settings (#6037) Improved detection of sample videos Improved stability of speed test (thanks, @henry701 Henrique Campos!) Fixed support for servers with no Internet access (#6047) (thanks, @henry701 Henrique Campos!) Fixed wrong Linux yt-dlp binary being packaged (#6011) (thanks, @Pro-pra!) Fixed API lookups happening for TV series when episode lookup fails, even if the series metadata is already in the local database (#6080) Fixed JDK being used in Docker image instead of JRE (#6089) (thanks, @mvanhorn Matt Van Horn!) Fixed editing a video feed on the web settings erases the URL (#6046) (thanks, @serinekjo kjo!) Fixed docs for FFmpeg GPU support (thanks, @Harshit-dell Harshit Kumar Sahu!) Translation updates via Crowdin Dutch (97%) (thanks, Lefteye!) English (United Kingdom) (80%) (thanks, Andi Chandler!) Italian (63%) (thanks, parduz!) Portuguese (Brazilian) (67%) (thanks, Henrique Campos!) Download: Universal Media Server 15.6.0 | 157.0 MB (Open Source) Download: Other operating systems View: Universal Media Server Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware -
By +Warwagon · Posted
Think of the children!
-
-
Recent Achievements
-
Captain_Eric earned a badge
Very Popular
-
amusc earned a badge
One Month Later
-
DJC50PLUS earned a badge
One Month Later
-
DJC50PLUS earned a badge
Week One Done
-
Eric Biran went up a rank
Proficient
-
-
Popular Contributors
-
Tell a friend
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