Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

My newlines get stripped.


  • Please log in to reply
2 replies to this topic

#1 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer


  • Malware Response Team
  • 12,304 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:10:47 AM

Posted 01 December 2008 - 02:17 AM

Hello :thumbsup:

void LogClass::Write(const LPTSTR toWrite)
{
	DWORD nothing;
	if (!WriteFile(logFile,toWrite,_tcslen(toWrite)*sizeof(TCHAR),&nothing,NULL)) {
		throw GetLastError();
	}
}

Here's my problem:
//Open the log
	LogClass logger(_T("%DESKTOP%\\DNSCheckLog.txt"));
	//Print header
	logger.Write(_T("DNSCheck v.0.8.0\n\n"));
	logger.Write(_T("somemoretext"));

Produces:
DNSCheck v.0.8.0somemoretext

The newlines got stripped.

Anyone know what's going on?

Billy3
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image

BC AdBot (Login to Remove)

 


#2 jpshortstuff

jpshortstuff

    WhatTheTech Teacher


  • Members
  • 660 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:UK
  • Local time:06:47 PM

Posted 01 December 2008 - 05:17 AM

Hi Billy :thumbsup:

Give \r\n a try for a newline character. When working with Unicode strings you will need the extra \r.

Hope that helps.
Trained at the What The Tech Classroom where you too could learn to help others.

My help is free, however, if you wish to make a small donation to show appreciation and to help me continue the fight against Malware, then click here Posted Image

Posted Image

#3 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer

  • Topic Starter

  • Malware Response Team
  • 12,304 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:10:47 AM

Posted 01 December 2008 - 12:37 PM

Thanks JP :thumbsup:

Way to take a simple function and complicate it like crazy.....

http://pastebin.com/f4d94aab3

Billy3
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users