Raised This Month: $7 Target: $400
 1% 

Solved OpenFile(sPath, "w")


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Randons Gamers
Junior Member
Join Date: Feb 2014
Old 05-08-2019 , 20:53   OpenFile(sPath, "w")
Reply With Quote #1

I created this code:
Code:
new Handle:hCfg = OpenFile(sPath, "w");
WriteFileLine(hCfg, "A");
WriteFileLine(hCfg, "B");
WriteFileLine(hCfg, "C");
CloseHandle(hCfg);
I expected this result in the file:
Code:
A
B
C
But the result is this:
Code:
ABC
what am I doing wrong?
plz help-me

Last edited by asherkin; 05-09-2019 at 04:06. Reason: Restore to previous version.
Randons Gamers is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-09-2019 , 05:27   Re: OpenFile(sPath, "w")
Reply With Quote #2

Print with \r\n if you need a carriage return before the new line.
__________________
Neuro Toxin is offline
CrazyHackGUT
AlliedModders Donor
Join Date: Feb 2016
Location: Izhevsk, Russia
Old 05-09-2019 , 08:06   Re: OpenFile(sPath, "w")
Reply With Quote #3

If you open file with default Windows Notepad - this is ok. On Windows, file lines ends on 2 bytes: carriage return (\r) and line feed (\n). SourceMod appends only line feed. Windows Notepad can't show normally files, where line ends only on line feed.
Any another custom editors, like Notepad++ or KDE Text Advanced Editor should display these files normally.

https://github.com/alliedmodders/sou....cpp#L785-L792
__________________
My english is very bad. I am live in Russia. Learning english language - very hard task for me...
CrazyHackGUT is offline
Send a message via ICQ to CrazyHackGUT Send a message via Skype™ to CrazyHackGUT
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode