|
I'm sorry but they took away my power to read minds when I came to this planet.
Maybe you would like to tell us what the error is and how you are trying to write to the file?
only two letters away from being an asset
|
|
|
|
|
here is my code to write the file
FileStream file = new FileStream("Web.ini", FileMode.Truncate, FileAccess.ReadWrite);
StreamWriter sw = new StreamWriter ( file );
the file is written successfully, only the problem is that instead of getting line breaks in the written file, i get small square. (while i want the line break to be written)
sAqIb
|
|
|
|
|
What are you using to read the file you've written? You may be exhibiting what would seem to be a quite simple problem but actually causes a lot of problems - there is no standard on what a line break should be. Windows uses CRLF (0x0d0a) where as Unix and its Linux offshoots use just LF.
Somewhere in .NET, I can't remember where, there is a setting which allows you to control this.
Are you going cross-platform at all?
Regards,
Rob Philpott.
|
|
|
|
|
nope. i am using windows, neither unix nor linux. i am using StreamReader to read the file from which the string is returned, and then using that string i am writing another file.
sAqIb
|
|
|
|
|
Where is the box being displayed? In the debugger?
Regards,
Rob Philpott.
|
|
|
|
|
You have shown how you are creating the file but have not shown how you are writing to the file.
sw.Write(...)??
only two letters away from being an asset
|
|
|
|
|
ya i am using
sw.write (iniData);
to write to the file
the actual code is like that
if (charArray[i] == '\n')
sw.write "\n";
else
sw.write (charArray[i]);
well i have tried this statement too
if (charArray[i] == '\n')
continue;
else
sw.write (charArray[i]);
in both cases i get a small box in the file which is being written. i don't want that box to be written. i am sure its because of break line character. but when i use continue, i still get it (bcoz it is from teh input string ).
sAqIb
|
|
|
|
|
As has been said, the problem is the application you are using to read the file, not in how the file is written.
You can also use Environment.NewLine in place of '\n';
only two letters away from being an asset
|
|
|
|
|
if i am doing wrong then suggest me how to read the file?
but there are line breaks in the input file as well thats y there is \n is the input string too
sAqIb
|
|
|
|
|
Hi,
use '\r\n' instead of '\n'
hope this works.
Nitin...
|
|
|
|
|
Hi,
I have VS Studio .NET 2003 Academic. Yesterday, when I select the toolbox option all the tools are now (either) missing or 'grayed out'. How can I fix this? I reinstalled all the disks under the "repair" option, then restarted, but the problem still persists. Also, the project I was working on was a WinForm w/ out much of my own code added.
Please help and thanks for your time.....I'm wasting a lot of mine....
ps- I have also downloaded VS .NET 2005 Enterprise edition.
|
|
|
|
|
How can i loop a string in c#? is there any method? (remember its not a string array)
sAqIb
|
|
|
|
|
You mean to loop the characters in a string?
The string class has an enumerator for the characters, so you can loop the string as if it was an array of characters:
foreach (char ch in daString) {
...
}
---
b { font-weight: normal; }
|
|
|
|
|
thanks buddy
i found another way to convert a string to characters. its
char[] charArray;
charArray = stringtoConvert.ToCharArray();
sAqIb
|
|
|
|
|
Yes, that's how you create a character array from a string. That was not what you asked for, however.
---
b { font-weight: normal; }
|
|
|
|
|
There's no need to do that if you just want to loop through the characters. In fact, that requires an extra allocation; so unless you need a seperate array, don't do that. Use foreach like Guffa said:
foreach(char character in myString)
{
...
}
or use a good old for loop:
for(int i = 0; i < myString.Length; i++)
{
char character = myString[i];
...
}
|
|
|
|
|
I use a text file to pass command line arguments to a ClickOnce application. My main concern is that if the argument sink fails to delete this file after using the arguments, and no arguments are passed the next time, it will use the previous arguments again.
I am open to suggestions on how to invalidate (expire) the text file somehow.
|
|
|
|
|
How about checking the file creation date against the current date, deleting the file if its "too old" and returning with an error, causing re-reading of the file or prompting the user to restart?
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
Using the time has crossed my mind. If my loader program names the file using the time, say rounded off to 30 seconds, then the loaded program uses the same algorithm to determine the filename to look for. If the loaded program starts more than 30 seconds after the loader, it will miss the file and show a dialogue to get the required argument.
|
|
|
|
|
When i search, all i find is custom menus, which would change the colour, but are a bit over the top
|
|
|
|
|
Doesn't matter, i ditched the menu all togeather, now i have a series of buttons, ooh
|
|
|
|
|
Hi
I am developing a scripts in C# which can be used to test windows based applications. I use Win32 API's to perform click operations etc. To uniquely identify a control in a window rather than using absolute position of a control I have been using Control-ids and captions of the control. But I found scenarios where the control-id was dynamic and the control didn't have a caption. What I mean by caption is the text of the control. A control, say a button can have both name and text - Name: btnOk and Caption: OK. What I hoping to get is the Name "btnOk" that can uniquely identify it in a window because no two controld can have the same name, but it can have the same caption. I have searched through the Win32 API's and I have been able to find a suitable API that does the job. Any kind of help will be appreciated. Thanks a lot.
with Regards
Anoop Kumar
|
|
|
|
|
Hi,
afaik the Handle of each window is unique. Everything (visual) has a handle.
|
|
|
|
|
Thanks mikone for the reply, but I have come across certain Win Forms where the Handle of the control changes each time I call the Application. For eg. I bring up Calculator (here it is same just for eg. sake) each time the handle for the button 7 may not be same. I am not sure if the forms are .NET forms. They could be VC based Win Forms, that is what somebody had told me. Thanks again.
With Regards
Anoop.
|
|
|
|
|
I've got a little problem, i've got one threaded class setting up all parameters and finially showing a MSN-Lookalike PopUp window, with a sliding effect. the problem is, the popup only slides 1 or 2px then it gets stuck. Calling the function within the class without using a thread causes no problem and it's shown as it's supposed to. Could anyone help me out or give me a hint ? please
class PopUpHandler<br />
{<br />
private string popTitle;<br />
private string popContent;<br />
TaskbarNotifier taskbarNotifier;<br />
public PopUpHandler(string strTitle, string strContent)<br />
{<br />
popTitle = strTitle;<br />
popContent = strContent;<br />
Thread popUpThread = new Thread(new ThreadStart(popupShowMessage));<br />
popUpThread.Start();<br />
}<br />
public void popupShowMessage()
{<br />
System.Reflection.Assembly myAssembly = this.GetType().Assembly;<br />
<br />
ResourceManager myManager = new ResourceManager("SystemTray.Form1", myAssembly);<br />
<br />
taskbarNotifier = new TaskbarNotifier();<br />
taskbarNotifier.SetBackgroundBitmap((Bitmap)Properties.Resources.imageSkin, Color.FromArgb(255, 0, 255));<br />
taskbarNotifier.SetCloseBitmap((Bitmap)Properties.Resources.imageClose, Color.FromArgb(255, 0, 255), new Point(127, 8));<br />
taskbarNotifier.TitleRectangle = new Rectangle(40, 9, 80, 25);<br />
taskbarNotifier.ContentRectangle = new Rectangle(8, 41, 133, 68);<br />
taskbarNotifier.Show(popTitle, popContent, 500, 4000, 50);<br />
}<br />
}
|
|
|
|