16,016,425 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by computerpublic (Top 13 by date)
computerpublic
29-Nov-17 17:08pm
View
//No compiler error occur, but it gives me a LARGE empty output file that keeps building
//Also the program does not end.
using System;
using System.IO;
using System.Collections;
namespace Applica
{
static class Program
{
static void Main(string[] args)
{
bool tif = true;
bool[] array = new bool[8];
BitArray bytes = new BitArray(array);
const int BufferSize = 1024;
byte[] buffer = new byte[BufferSize];
FileInfo ap = new FileInfo("tempii.txt");
string filePath = ap.FullName;
string destinationPath = Path.Combine("C:\\check", Path.GetFileName(filePath));
using (Stream output = File.OpenWrite(destinationPath))
{
int amount = 1;
while (amount > 0)
{
for (int i = 0; i < 8; i++)
{
if (tif == true)
{
tif = false;
}
else if (tif == false)
{
tif = true;
}
array[i] = tif;
}
bytes.CopyTo(buffer, 0);//No compiler error occur, but it gives me a LARGE empty output file that keeps growing.
output.Write(buffer, 0, amount);//Also the program does not end.
}
}
}
}
}
computerpublic
29-Nov-17 4:41am
View
//I have modified the code as you suggested, and I am still getting the same error. Please see below.
using System;
using System.IO;
using System.Collections;
namespace Applica
{
static class Program
{
static void Main(string[] args)
{
bool tif = true;
byte[] buffer = BitConverter.GetBytes(tif);
FileInfo ap = new FileInfo("tempii.txt");
string filePath = ap.FullName;
string destinationPath = Path.Combine("C:\\check", Path.GetFileName(filePath));
using (Stream output = File.OpenWrite(destinationPath))
{
int bytes = 4;
while (bytes > 0)
{
for (int i = 1; i < 33; i++)//4 random bytes
{
if (tif == true)
{
tif = false;
}
else if (tif == false)
{
tif = true;
}
output.Write(buffer, 0, bytes);
}
}
}
}
}
}
computerpublic
28-Nov-17 19:10pm
View
I am still looking for help if anyone is kind enough to help. Thank you in advance.
computerpublic
24-Nov-17 12:43pm
View
OriginalGriff thank very much for your assistance. Can someone in this forum please assist? I don't it is being understand that nothing i do works. I have been at this for weeks. I am totally going in circles and very confused about how the syntax work. It's not for a lack of trying. I have tried so many different ways to succeed and end up with nothing.
I am using a loop with the variable "Totbyte" from the original program to control the loop that will start and terminate the process after the exact amount of bytes as been entered. I also want to use "output.Write(buffer, 0, bytesRead);" to assemble back the file. I am having two(2) problems.
1. How to correct nullified variables that as been commented out.
2. How to enter the new byte with respect to "output.Write(buffer, 0, bytesRead);"
computerpublic
23-Nov-17 15:27pm
View
Please let me first say that I am here looking for help. Once i comment out "using (Stream input = File.OpenRead(filePath))", it nullifies other variables which are dependent to the line being commented out. So what I end up with, are other variables which also need to be commenting out and the problem snow ball in other problems. All I want to do is have someone show me how to redo the structure where i am still doing "output.Write(buffer, 0, bytesRead);", but taking the input manually one byte of a time (assume that i have them all the bytes written down on a piece of paper). I no longer want to do the "Read in from file" to get the bytes, but I want to build back the file from all the bytes entered. I am not a professional programmer like the people in this forum. I know my screen cannot be seen, but the entire code is here to be ran. It's only a few short line of code. I do not understand how to fix this problem. If you genuinely know how to fix this problem, please help me. Thank you.
computerpublic
23-Nov-17 7:19am
View
All you are doing is saying what I said I did. I did comment out "using (Stream input = File.OpenRead(filePath))" and it created problems in other parts of the code. I said I did this when I first ask the question.
computerpublic
29-May-15 6:44am
View
This is useless, you have me going around in circles and you offer no help at all. You know that I am new to programming and you are being difficult. Please don't waste my time anymore.
computerpublic
28-May-15 19:55pm
View
correction: I don't care about the debugger because it seems like this is not the issue. What I want to do is simply run a program and have the last five(5) results of variables uint A, uint B, and uint C go straight to an external file called c:\test. Can you please show me how to do this?
computerpublic
28-May-15 19:41pm
View
I still do not understand how to get the last 5 lines of the debugger. Its been several days. I did as you told me and I am still stuck. What exactly do you want me accept? I just to get the thing to work. Can you show me how to get the last 5 lines of the debugger into an external file?
computerpublic
28-May-15 0:48am
View
The following is the only example that comes anywhere close to what i am trying to accomplish, however I don't understand how to put the last 5 lines of the debugger inside it.
// Create a file for output named TestFile.txt.
Stream myFile = File.Create(@"c:\check\TestFile.txt");
//* Create a new text writer using the output stream, and add it to
// * the trace listeners.
TextWriterTraceListener myTextListener = new TextWriterTraceListener(myFile);
Trace.Listeners.Add(myTextListener);
//Write output to the file.
Trace.Write("test");
// Flush the output.
Trace.Flush();
computerpublic
27-May-15 5:53am
View
Sir,
I have read the msdn's and looked at the examples. I dont understand why you say I am not writing anything to Trace. Can you show me how to fix the String Output line?
computerpublic
23-May-15 10:21am
View
I still cannot figure out how to complete what you wrote. I don't understand why you would write something incomplete.
computerpublic
18-May-15 17:13pm
View
I don't see where you named and created any external file?? How do you do this??
Show More