|
Carriage return is '\r', linefeed is '\n'.
Text files on Windows usually end lines with a carriage return and a linefeed character.
But to answer your question: a carriage return has 1 character.
|
|
|
|
|
what about if it is a free text like this box that we post and we hit enter what is the character?
|
|
|
|
|
As Steven said, the carriage return character is a single character.
I think that what you actually are looking for is the new line character sequence.
A new line sequence can either be one character (line feed) or two characters (carriage return + line feed). A unix/linux based system used a single character, while a DOS/Windows based system uses two characters.
In C#, the escape sequence \r gives you the carriage return (CR) character, and the escape sequence \n gives you the line feed (LF) character.
To get the new line character sequence for the system that the program is currently running on, use the Environment.NewLine property.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Environment.NewLine.Length = 2
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
leppie wrote: Environment.NewLine.Length = 2
Yes, in Microsoft's implementation of the CLR. If you run the same program in Mono on Linux, the length is one.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
2 characters, just as you see them.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Hello,
I am trying to find some examples and information on how to add COM to the C# application and connect to a COM server that was created with C++. Any help would be wonderful.
Thanks
|
|
|
|
|
|
Delete your garbage post. SUpport the site buy buying advertising space, like every other legitimate advertiser on the site.
|
|
|
|
|
Is there a way to programatically extract an crystal report into c# as an image object?
|
|
|
|
|
AFAIK no. However you can export the document to Excel, PDF, HTML etc.
The need to optimize rises from a bad design
|
|
|
|
|
Hello all:
I am having a problem with a Windows Service that I'm writing in C# using Studio 2003. The main service will start fine, but for some reason the OnStart() and OnStop() methods in the additional service never fire on their own. As a workaround, in the second service I added a line to the InitializeComponent() method to call OnStart() since the Initialize method is actually called. This works as a workaround to get the service doing what it should, but then the OnStop() is never used and this seems a little odd to me. It does work this way, but I can't believe this is how it should be and I would like to have it running right. If you have any ideas, any help would be appreciated.
Main Method in first service:
static void Main()
{
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new MendsInterface(), new MendsToAllscripts()};
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
Initialize Method in the second service:
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.ServiceName = "MendsToAllscripts";
_common.LogMessage("Initializing Allscript service");
OnStart(null);
}
Thank you!
|
|
|
|
|
Brett G wrote: I added a line to the InitializeComponent() method to call OnStart()
That's no good. OnStart() is meant to be called in response to
the service control manager.
Brett G wrote: The main service will start fine, but for some reason the OnStart() and OnStop() methods in the additional service never fire on their own
How are you starting the additional services? If you're not getting
OnStart/OnStop calls then the service hasn't started.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Just realized that I only had one service installer set up. Added a second installer for the other service and things are running much better now. Thanks!
|
|
|
|
|
Thanks for the update!
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have a file whose content like this :
1 2
3 4
I wonder how can I read them to 4 variables a, b, c, d
I tried using Read or ReadLine to read but there was no result
Would you mind helping me ?
|
|
|
|
|
Use a StreamReader[^] to read each line.
Put each line into a String variable.
Call theLine.Split(' '); on the string passing a space as the delimiter. This will give you an array of the values.
Loop through the array and use int.TryParse(...) to convert each string in the array into an integer.
Simon
|
|
|
|
|
I second that.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Alternatively, you can also use a regular expression on each line, it would look like this:
^(\d+)\s+(\d+)
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi All,
I have an application that needs to send some basic text back to a console on another pc at another site via the internet.
The apps at both ends do just what they need to, but i have no idea how i should be sending the data.
Any ideas would be gratefully received!
Thanks,
Phil
|
|
|
|
|
ph1l2 wrote: but i have no idea how i should be sending the data.
Any ideas would be gratefully received!
check this out[^]
led mike
|
|
|
|
|
I was wondering how to do this too. I know at an abstract level that sockets (IP address + port number) can be used. But I'm missing the details on how get it set up and working.
|
|
|
|
|
Alan Balkany wrote: But I'm missing the details on how get it set up and working.
Try this site[^]. It has been around since the mid 90's.
led mike
|
|
|
|
|
|
Great, thank you for your help led mike
|
|
|
|