|
<code>static string file="";
static string line="";
static void Main(string[] args)
{
StreamReader sr=new StreamReader("d:\\file1.txt");
StreamWriter sw=new StreamWriter("D:\\file2.txt");
while((line=sr.Readline())!=null)
{
file="\""+line+"\\r\\n";\\editing the line read from the file
sr.WriteLine(file);
file="";
}
}</code>
file 1 has abt 700 lines and file2 is destination...
|
|
|
|
|
Is the problem that you are missing the <CR><LF> characters from your output file and are you using ReadLine() [^] to read your input file? If so, note that the line end characters <CR> and/or <LF> do not get copied into your input buffer.
It's time for a new signature.
|
|
|
|
|
if you want help with your code, do not tell us anything or show us any code!
The easy ways out:
File.Copy
File.WriteAllBytes(File.ReadAllBytes())
|
|
|
|
|
close your writer when your done, it's probably just not flushing...
sw.close();
also your are calling write line on a stream reader instead of your stream writer...
|
|
|
|
|
sorry.. it was sw.WriteLine()
ok.. so let me see it..
|
|
|
|
|
its working now.. thanks...
thank u very much...
|
|
|
|
|
|
when creating your deployment project,... use the "File Type" Editor to do the association of a file extension to your app, you can configure down to an icon for your files. am not that familiar with WPF, but I can tell you that it does not have to be a console app to pass the args (which will be the file name when you double click on your file type icon). anything that has main entry funtion can be used(i.e windows forms application)
|
|
|
|
|
|
Collin Jasnoch wrote: Does the start app need to be a console app so it can get arguments
FYI: all kinds of apps (Console, WinForm, ...) can get arguments, you pass them interactively on the command line, or in the definition of your Explorer desktop shortcut, or in your Visual Studio debug command line, or in ProcessStartInfo, or...; and your app gets them through the static Main parameters, or Environment.GetCommandLineArgs, or ...
|
|
|
|
|
I have a problem getting the right data from the database.
I have two tables named "Category" and "Items". Under one category, there can be multiple items.
table for category looks like:
catagory_ID | catagory_Name | catagory_Description
and the table for item looks like:
item_ID | cat_ID | item_Name | item_Description
Here category_ID and item_ID are unique keys and cat_ID is the foreign key which is the category_ID.
now i want the query which gives the list of data under typical category in the list format.
e.g if Book is the category Name and book_name1,book_name2,book_name3 are the items under category, it should look like
Book
book_name1
book_name2
book_name3
how to do that? Well i can get something like this:
Book book_name1
Book book_name2
Book book_name3
but I want the category just once in the output..
I am using asp.net with c# and sql server..
code is:
<asp:Repeater runat="server" id="Repeater1">
<HeaderTemplate>Categories<br /></HeaderTemplate>
<ItemTemplate>
<b><%# DataBinder.Eval(Container.DataItem, "category_Name") %></t></b>
<br><%# DataBinder.Eval(Container.DataItem, "item_Name") %></br>
</ItemTemplate>
</asp:Repeater>
suchita
|
|
|
|
|
SayamiSuchi wrote: I want the category just once in the output
Then only put it there once. You control the output.
|
|
|
|
|
i tried the nested itemTemplate one for category and one for items but it gave the same output. Didn't work that way..
suchita
|
|
|
|
|
SayamiSuchi wrote: nested itemTemplate
I have no idea what you're talking about. I just suspect you'll need to do some actual programming. (You'll be better for it.)
|
|
|
|
|
ok. Let me explain again. I have two tables named category and item. Below are the fields of category and item respectively.
catagory_ID | catagory_Name | catagory_Description
and the table for item looks like:
item_ID | cat_ID | item_Name | item_Description
Here category_ID and item_ID are unique keys and cat_ID is the foreign key which is the category_ID.
I wanted to show the category and item in the format like below:
Here there should be only one category but for each category, there can be several items under that.
e.g if Book is the category Name and book_name1,book_name2,book_name3 are the items under category, it should look like
Book
book_name1
book_name2
book_name3
I am getting the output like shown below: Here I am having category name also repeatedly which i don't want.
Book book_name1
Book book_name2
Book book_name3
I want the category just once in the output..
I am using asp.net with c# and sql server..
code is:
<asp:Repeater runat="server" id="Repeater1">
<HeaderTemplate>Categories<br /></HeaderTemplate>
<ItemTemplate>
<b&><%# DataBinder.Eval(Container.DataItem, "category_Name") %></t></b>
<br><%# DataBinder.Eval(Container.DataItem, "item_Name") %></br>
</ItemTemplate>
</asp:Repeater>
suchita
|
|
|
|
|
Yes, but you don't seem to want to do any work to achieve your goals.
I don't do ASP.net; I write real programs.
|
|
|
|
|
I tried nested itemTemplate too but it gave the same output..
suchita
|
|
|
|
|
I don't do asp but it looks to me like you need a repeater within a repeater.
In pseudoish code something like:
asp:Repeater
HeaderTemplate
ItemTemplate
Data - category name
asp:Repeater
ItemTemplate
Data - item name
/ItemTemplate
/asp:Repeater
/ItemTemplate
/asp:Repeater
Whether or not you can do that I haven't a clue - but that looks like the logic you need.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
yes. I tried that way too but the data inside the nested repeater doesn't show up.
suchita
|
|
|
|
|
hi
how to call published web pages from windows services that I create
thanks
|
|
|
|
|
|
You can use a System.Net.HttpWebRequest from any type of application.
|
|
|
|
|
Hi
Currently considering to learn som C# to use professional at work. I've been looking at courses from "www.learndevnow.com" and "www.learnvisualstudio.net". Any one with experience with these or have any recommendations.
/Eiel
|
|
|
|
|
|
I have no experience with online programming courses, but I'm a bit suspicious about them (I'm talking about payd courses, not about tutorials of course). Expecially if you are already experienced with programming in any other language, I think the best is to buy a good book, and make experiments with sample application (you can download plenty of them from Code Project).
Cheers,
Sauro
|
|
|
|