Click here to Skip to main content
15,889,651 members
Everything / IO

IO

IO

Great Reads

by honey the codewitch
BinaryReader needs a better way to read strings and types. Here's a quick and dirty fix
by Alexander Eremeev
The Windows kernel-hacking library and development framework written on C++17
by Bruno van Dooren
How to implement named pipe server for communicating with client apps
by V.
Convert FITS file to known image formats and use those images for a "zooming" functionality (image transparency)

Latest Articles

by Michael Sydney Balloni
See how Rust stacks up against C-ish, C++, and C#
by Bruno van Dooren
How to implement named pipe server for communicating with client apps
by Bruno van Dooren
How to implement named pipe server for communicating with client apps
by honey the codewitch
Run your IoT display driver independent of the bus it uses, whether I2C, SPI or parallel

All Articles

Sort by Updated

IO 

17 Jan 2020 by 49R
How raw data is divided into bytes. As present audio contains 32bit(2^32 tones) it ranges from 2^0 - 2^32. ex -> 6710497.. (Considering decimal) how is it divided to 67 104 97 Does FileInputStream has a method to check like if(671>256){send 67 , next append 1} What I have tried: ...
2 Jan 2014 by Abhilash K M
Private Sub browseXLfile_Click(sender As Object, e As EventArgs) Handles browseXLfile.Click Dim ofd As New OpenFileDialog If ofd.ShowDialog() System.Windows.Forms.DialogResult.OK Then Exit Sub Dim nme As String = ofd.FileName Dim safename As String...
26 Aug 2011 by Abhinav S
IF you are using .Net 2.0, you will need to use Web Service Extensions[^] and MTOM.
8 Jan 2012 by Abhinav S
These folders are created in a temporary storage location (like a cookie).You cannot directly access the harddrive path in Silverlight (unless you run with elevated permissions).That is the whole idea behind running Silverlight in a sandboxed environment.
21 Feb 2018 by Adi Eduard
This article describes how to get a file's encoding with C#
27 Jul 2015 by Akbar Giffary
Case ("3. Surat Tugas")Dim path As String = System.IO.Path.GetDirectoryName(Application.ExecutablePath) & "\LETTER\SURAT TUGAS.docx\"System.Diagnostics.Process.Start("explorer.exe", path)hi all, this is code what i've done before, it's works fine if the program installed on my local...
1 Nov 2018 by Alexander Eremeev
The Windows kernel-hacking library and development framework written on C++17
16 Oct 2015 by Am Gayathri
How to fix 'Access to the path 'D:\Fol_x\' is denied. error while try to download file using C# code.Am trying to download code using C#. But am getting error,'Access to the path 'D:\Fol_x\' is denied. Sounds like error is simple but i couldn't i tried all the solutions which i got from...
5 Jun 2011 by ambarishtv
below code shows the given text and their mirror position in picture box.Here i'm using System.Drawing.Drawing2D.Matrix class private void pictureBox1_Paint(object sender, PaintEventArgs e) { Graphics graphics = e.Graphics; graphics.DrawString("Ambarish!",...
28 Sep 2014 by Andreas Spalenski
You can use the TextReader TextWriter classes instead of StreamReader/Writer.
1 Apr 2018 by apb007
Hi there, I am currently trying to make a sort of io version of call of duty zombies and dying light. So far it is coming along nicely, until i hit this snag. I would like to make 2 modes: 1) an open world where quests can be completed *kinda like dying light ish* 2) a survival map based thing...
9 Sep 2015 by Arsalan Memon
What's the actual difference in stream and filestream. i mention two instances below please explain what's the difference in below two lines. both are doing same work but i want to understand actual difference?// Stream s = new FileStream(filename, FileMode.Create);// FileStream fs =...
26 May 2011 by Ashishmau
As far as i understood,,,overwriting problem is there.change ur streamwriter with thisStreamWriter SW = new StreamWriter(fs2,true);
28 Sep 2014 by ashok rathod
1. You can use Dictionary for storing user score with their name as keys and scores as values. For Storing operation check below link or try googling for sorting operation on dictionary object.http://www.dotnetperls.com/sort-dictionary[title="New Window">^]
30 Jan 2012 by Auric Consulting, LLC
In the code below, there is a BeginRead call which I want to use in an async manner. (warning, code is cobbled together using a variety of code samples found lying around on the internet!) With this sample, I expect the BeginRead to return immediately, and then the callback to be hit later on...
7 May 2013 by bdeklerk
private void btnGetFolders_Click(object sender, EventArgs e) { string[] dirs = Directory.GetDirectories(@"DirectoryPath eg. E:\Music"); foreach (string dir in dirs) { lstMusic.Items.Add(dir); //Adding the list of...
23 Jul 2012 by Behnam Mohammadi
I want delete a file but an error occured please help me.==============================The process cannot access the file 'D:\My Project\AzadUniv\New\12\GUI\Upload\NewsImage\5564868769930125853-Image' because it is being used by another process.==============================string...
30 Jul 2012 by Behnam Mohammadi
hii'm sorry for my poor english.i want create a gallery without database.for categorys create FOLDERfor photo items upload photos on folderbut i ask this method has problem or is true?if anyone has better sulotion please saythank you.
2 Sep 2013 by Bernhard Hiller
Do you really use Key :=Valueor rather key=value? In the last case, you can use the Windows API for ini-files.Otherwise, you have to read the file line by line and parse each line with a regex.
9 Feb 2015 by Bhis
Various ways to sort list and compare results
29 Jan 2012 by BillWoodruff
The first thought that comes to mind is using a USB flash-drive that can be password-protected. This company claims its password-protection software is free: [^], but I have never used it.This CP article may be helpful as a starting point: "Developing a USB Storage Device Protection Tool...
29 Sep 2014 by BillWoodruff
Re the issue asked about in the title of the question:1. Assumes the delimiter character is a comma.2. illustrates some elementary error-checking and reporting, use of 'throw, etc. but, by no means thoroughly checks the file being read for correctness.private Dictionary...
16 Nov 2011 by Binu Varghese K
Now you are doing is writing line by line.Which will generate a new line after writing each line by default. So the better idea is to us writer.write("your text") instead of writer.writeline("your text").
27 May 2011 by BobJanova
You are explicitly seeking to the position of the first cell. If you don't want to write to that position in the file (which won't work in all cases anyway as your cell record is not a fixed length), seek to the end.If you want to be able to overwrite a single record in place, you need to...
21 Jul 2014 by Brad Joss
Search for files and folders and don't exit the search when there is an error accessing a protected folder, just skip it.
18 Feb 2017 by Brady Kelly
Just recently my PC's performance has become dismal, I even got about 10 'pauses' in the editor while typing these two sentences. Now if I used Process Explorer, I can sort by CPU, memory, and IO, descending, so the culprits are always visible at the top of the table.The problem with that is...
22 Dec 2022 by Bruno van Dooren
How to implement named pipe server for communicating with client apps
9 Dec 2022 by Bruno van Dooren
How to implement named pipe server for communicating with client apps
4 Jun 2011 by Christian Graus
You have the position of the ellipse, and you have the text, which you can write with WriteString ( or DrawString, I forget ). So, where is the issue ?
7 Dec 2016 by Codes DeCodes
I have generated .DAT file and stored it in Server temp folder. Now When user clicks on Download button, the file is to be downloaded into their system. Before downloading a file, I want the browser to ask for a location in client's system like the way it happens when user downloads file in...
4 Jan 2012 by CPallini
There's no 'insertion' functionality for files: you have to create a new file with the appropriate content:Read line by line from input file (you may use the StreamReader.ReadLine Method[^]) and output the read line to the ouput file, until line count reaches 500.Then write the '10 rows' to...
7 May 2013 by CPallini
The DirectoryInfo[^] class provides all you need, namely the GetFiles, GetDirectories methods and the Parent property.
13 Dec 2018 by CPallini
Quote: Example 1: If you need to know information about the next line(s) or previous line(s) to decide how to process the current line. Example 2: The current line indicates you have read too far and you must send it to a different context of your parser. Both of such problems are usually...
24 Apr 2021 by CPallini
Your for loop overruns the number of the quiz proposed questions. I've fixed that (and other bugs, adding remarks on modified lines of code). Try (Please note, using Java facilities, there are far better ways to write such a code). import...
2 Apr 2012 by cpquest
Hi all,i have some doubts in creating xml from a class that i have. I need to grenerate a xml file in my local filesystem the Nodes and Data of a xml should be Generated once from the first time. What ever changed made in the data should be saved in the genereated XML in my local file system...
26 May 2011 by cuteband
You can use this. Dim Stack As New System.Collections.StackDim SR As System.IO.StreamReaderSR = File.OpenText("C:\\Documents and Settings\\Administrator\\cell.txt") Dim LogLine As StringDo LogLine = SR.ReadLine If LogLine Is Nothing Then ...
28 Dec 2015 by danah gaz
A lightweight, high performance, easy to use asynchronous stream copy method using IOCP with progress, throughput tracking, and no explicit thread creation.
18 May 2011 by Dave Kreskowiak
I can't see any problem with GetDirectories. Then again, I'm an admin on my own machine and don't have UAC running.From what I can tell, you cannot get all the folders without being an admin on the machine and running the code as an admin. If you have UAC enabled on your machine, your code...
19 May 2012 by Dave Kreskowiak
Your description is pretty confusing. We have no idea what you're really having a problem with, so, the generic explanation:You have to read the file line by line to find what you're looking for. If you don't find it, write the line out to a new file.If you do find what you're looking...
13 Nov 2012 by Dave Kreskowiak
All of this depends on your PBX and the interfaces it exposes. Consult the documentation on your system.
21 Nov 2012 by Dave Kreskowiak
First the writer.Close (not CloseStream!) should be inside the If block directly above it, not after the End If.Second, the path seperator character in Windows is "\", not "/".
10 Jan 2013 by Dave Kreskowiak
You have a bigger problem. The FSW was not designed to watch an entire drive. You'll have problems with it and miss events. It may also use enough resources to bring the system to a crawl.Test TEST and MORE TEST!
5 Apr 2018 by David Crow
I suspect you want something like: InputStream stream = manager.open("firmware/" + file);
16 Feb 2015 by DavidGeirola
hi i'm david and i'm new in this site, i'm here because i have a problem with my solution of Client-Server communication.I have created 3 classes 'STransferMessage', 'SServer' and 'SClient'.SServer and SClient extend STransferMessage, i thought it might be the best solution because more...
9 Mar 2011 by Deepthy haridas
Hi!I am trying to connect my employee registration code with a RFID reader. I am not able to read from COM1 port. I used all the tecniques provided by google to my best knowledge.give some solution...Can somebody please help me in this?Thanks in advance!
17 Nov 2014 by den2k88
The thing I see is that you're not closing the file after having it scanned the first time. So what happens?The first time you cycle through the file you go right until the END OF FILE, and the internal read pointer of the FILE structure points there. Then you try to read other t_size number...
17 Nov 2014 by den2k88
while ( fscanf ( fp, "%d", &value) == 1) // read one integer { o++; // this loop will continue until EOF or non-integer input }now you're at EOF if ( o > t_size) // If the second line of the file...
29 Nov 2012 by Dharmateja Challa
To trap EInOutError enable "I/O checking" in the Pascal tab of the project options in order for EInOutError exceptions to be trapped. It seems EInOutError is a delphi class
18 Dec 2015 by dynamichael
Use extension methods, Encoding, and BitConverter to read and write native types on an IO.Stream object
20 Jan 2012 by E.F. Nijboer
If you use the example in the following link I believe you when you say it is very slow.http://www.dotnetspider.com/resources/28359-Export-DataGridView-into-csv-file.aspx[^]The reason for the code to be slow is the fact that it concatenates strings over and over again. (eg. strExport +=...
30 Jul 2012 by El_Codero
Hi,I'm sure you can use this open source photo gallery library from codeplex, read the code, try to understand it and fit it to your pruposes.http://photohandler.codeplex.com/[^]Regards
25 Jun 2011 by Espen Harlinn
You may find this article to be of some interest:File System Browsing in ASP.NET: New Approach vs. Old Approach[^]Best regardsEspen Harlinn
2 Dec 2012 by Expert Coming
Not really. The only option I really see is decrypting the file in-memory and passing that to the third-party application.The flaw really lies in the fact that the third party application doesn't do the encryption/decryption itself AND doesn't provide a way to pass in the decrypted information.
23 Jul 2012 by fjdiewornncalwe
You are attempting to delete the file that was read in within the thumbnail object. Perhaps if you disposed of the thumbnail object, the file resource would be released.
17 Oct 2012 by fjdiewornncalwe
We're not going to do your homework for you, but I will give you some pointers.1) You'll need a collection object to put the words into as you read them.2) Before you actually insert a found word into the collection, you'll need to make sure that the word doesn't already exist in the...
2 Dec 2012 by Franklin Barnett
I have a file which should be opened in a third-party program. That file is encrypted until it is needed. When the user runs my C# program, it will decrypt the file, open it with the third-party software, then when the software is done, it will re-encrypt the file. The third-party cannot do the...
6 Dec 2012 by Franklin Barnett
Found out my issue. Granted the whole scheme is a bit unorthodox, but modifying the target application itself isn't practical.I ended up revisiting the Dokan solution. Dokan creates a sort of virtual hard drive out of an empty folder or creates a new drive. This time I successfully modified...
18 May 2011 by Freeboss
I'm trying to get all the subDirectories of a directory using the:DirectoryInfo.GetDirectories("*",SearchOption.AllDirectories).On all folders i have tested this is returns correct results BUTIf u execute this on "C:\Windows\System32 you will find 2 problems:1.(Solved) Is about a...
23 May 2011 by Freeboss
I found the solution.It's not some folders that are secured or anything..If it was this even Windows Explorer wouldn't show em.Anyway Visual Studio 2010 with or without Sp1 has by default "Platform Target" x86.So if you run this on a x64 machine, the Framework does something like...
23 Nov 2011 by Freeboss
Post is old but for future reference here is the solution i found:http://alphafs.codeplex.com/[^]
4 Apr 2011 by funniezatee
Hi all,I am in a fix for a better solution here for my digital web shop.My situation is that I have 6 packages for sale, each containing 1GB of files on my server.These files will be uniquely watermarked before being compressed to allow fordownload by each buyer - reason to uniquely...
17 Nov 2014 by GeorgeGkas
Problem solved! .........................
21 Nov 2014 by GeorgeGkas
How can I write a code in C to check in my file contains only 3 lines of text?Eg9820 sads88182c 9 298 288812cec 9 2 88 828 If there are less or more than 3 lines writen in my txt file called test.txt then the program will return an error message and will exit.
24 Apr 2021 by Gray Kim
import java.io.*; import java.util.*; public class GameGuess{ int x; int ctr; public static void main(String [] args){ new GameGuess(); } public GameGuess(){ GameGuess1(); } public void GameGuess1(){ Scanner con = new...
4 Jan 2012 by Harshad-HBK
Hi to all,I am checking a notepad file which contains almost 5000 lines of records.I have to insert 10 rows of records after each 500 lines in the same file.After doing the job I will have a file which will contain total 5100 lines of records.Original...
20 Jan 2012 by Harshad-HBK
I want to export a sql datatable to notepad file without looping through each row.I have a data table, containing almost 60 to 70 lacks of rows.It is very time consuming to loop through every row and write it in text file.Tools:Framework 2.0Language VB.NetPlease Advice...
29 Jan 2012 by Harshad-HBK
Hi to all,I have developed a software (CRM) and sending quotations from Microsoft Outlook.All the mail credentials for the mail comes from server pages.I have used 'Microsoft.Office.Interop' namespace.Following is the code for reference :-Imports System.NetImports...
30 May 2012 by Harshad-HBK
hi to all,I am working with text files in desktop app(vb.net). Framework is 3.0.I have a several(e.g. 10) text files each containing 10,000 records.e.g.17725534 87489382983417725535 31355413215417725536 981521451554and so on.I have another file containing 200...
26 May 2011 by Hemant__Sharma
The problem is the point from where are you writing wont shift rest of the text ahead it will overwrite it so the idea to write in between something is 1- get the index where you want to write2- get the string after the index and store in some temp variable3 - write your new text at the...
30 Jan 2012 by Herman<T>.Instance
static public void BeginAsyncReadshould bestatic public IAsyncResult BeginAsyncRead
1 Aug 2012 by Hesha
I face a problem when i read text Files. what i did is i get certain details from the user Webform. i used to get customer Address via "MULTILINE" Textbox. EX:NO.100,BLOCK 75/A,Nelson Road,New York,USA.Then after generating Text File i used to read data from particular text...
24 Sep 2012 by Hesham Meneisi
Well, assuming 2 or more files are on the same partition, can we actually merge them without having to copy them all into one new file?What I'm talking about is, keeping their data in place, deleting their paths and creating a new single path that points to all the files, in a specific...
22 Aug 2013 by hk.v
Is it possible to access the raw data (like traversing sector by sector) of hard disk using java ? If not, please tell the reason.....thnx in advance
2 Feb 2020 by honey the codewitch
Add UTF-32 support and easy foreach streaming to your apps
19 Mar 2020 by honey the codewitch
BinaryReader and BinaryWriter can be used to parse or write binary files more easily and in a portable manner
23 Jul 2020 by honey the codewitch
Add progress reporting to your downloading or copying using this code
23 Apr 2021 by honey the codewitch
BinaryReader needs a better way to read strings and types. Here's a quick and dirty fix
18 Feb 2022 by honey the codewitch
Run your IoT display driver independent of the bus it uses, whether I2C, SPI or parallel
13 Dec 2018 by HS_C_Student
It's pretty common that I will use fgets() in a loop to iterate through the lines of a file and process them. Normally it works well but in some cases it sucks. Example 1: If you need to know information about the next line(s) or previous line(s) to decide how to process the current line. ...
21 Nov 2012 by jamiebones
Please i am trying to write the result of a loop in my code into a text file that on the harddisk. I am getting an IOEXECPTION error that the file you are trying to access is currently used by another process.Sub Main() Using myreader As StreamReader = New...
23 Nov 2012 by jamiebones
Hello please i am trying to save the result of an operation where i modified some text in a sample application. The problem is i am having difficulty in trying to loop through all the data.Trying to print out my result to a file, i get only the last line of the file.My code simply refuse to loop...
7 Dec 2015 by JarmoP
If the file is in a network folder, and the network connection to that folder breaks, FileStream open may freeze. The only solution is to put it in a new thread and kill that thread after a timeout, if needed.
19 Nov 2013 by Jaydeep Jadav
Hello,I am developing an application to read a NFC Tag UID from NFC Reader (ACR122U-A9) device. I used JAVA and javax.smartcardio API to detect the NFC Reader and Reading NFC Tag.The functionality of the application is to display notification when the NFC Reader device is connect or...
2 Apr 2012 by JF2015
I guess what you want is XML Serialization to directly store the structure of your objects. See here for more information:http://www.switchonthecode.com/tutorials/csharp-tutorial-xml-serialization[^]http://support.microsoft.com/kb/815813/en-us[^]
12 Jul 2011 by JOAT-MON
Maybe you should try disposing the streams, not just close them:w.Dispose();fs.Dispose();
18 Mar 2014 by Johannes Bildstein
Reading and writing Bitmaps with full 16bit per channel (and possibly more)
30 May 2012 by Jαved
Hi Harshad,Refer this link to achieve your goal-searching-for-line-of-one-text-file-in-another-text-file[^]Or follow these steps-1. read both files line by line [Link][^]2. split each line on their white spaces [Link][^]3. for both files, create a 2 dimensional array [Link][^]4....
1 Aug 2012 by Kamalkant(kk)
If u want to read from .txt file then below code will helppublic static DataTable exceldata(string filePath) { DataTable dtexcel = new DataTable(); var filename = filePath; var reader = ReadAsLines(filename); //...
13 Dec 2018 by KarstenK
When it is the work of the app to parse the complete file it should be no problem. Test it. At best you use some standard containers like int this file reading example code.
28 Sep 2014 by kmllev
I'm trying to create a leaderboard, but here's what I have so far and I'm a bit stuck.class utilizeLeaderboard { string mode; bool gameover; string playername; int playerscore; StreamReader sreader; StreamWriter swriter; ...
29 Jan 2014 by Kornfeld Eliyahu Peter
Rendering PDF Content in Windows Store Apps[^]
1 Jan 2013 by kosay85
HelloI need too monitor all local driver so I code thisPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim allDrives2() As IO.DriveInfo = IO.DriveInfo.GetDrives() Dim dd As IO.DriveInfo Dim N As Integer = 0 Dim T(10)...
15 May 2011 by kribo
How to insert images / binary data into a database.
24 Sep 2012 by Kuthuparakkal
try:http://blogs.msdn.com/b/jeffrey_wall/archive/2004/09/13/229137.aspx[^]
26 May 2011 by Legor
As i understand it you have one case where you want to override a CELL/CELLEND block in your file and another case were you want to add a new block to the file.So you'll have to consider these two cases. The code you've showed right now allways finds the first occuring CELL block and...
26 May 2011 by Liju Sankar
I would recommend for File.AppendText(FileName, NewText)
27 Nov 2012 by lilyNaz
I have written a code in C++ builder in which I use header FileCtrl.hpp and I call SelectDirectory procedure so that the user can choose the a directory. When I change the drive to empty floppy disk or DVD drives, I get Exception EInOutError. I used try catch, bu it didn't work.try{ ...
22 Dec 2012 by lilyNaz
I used SHBrowseFolder instead and everything turned out OK.
28 Sep 2014 by LLLLGGGG
Hi,You can read the file in a string array with File.ReadAllLines(yourfilenamehere);.Then create a class which encapsulates a player. Create two fields into it: name (string) and points (int or float or whatever numeric type you want).Make the class implements IComparableYou will now...