Click here to Skip to main content
15,889,992 members
Everything / General Programming / File

File

file

Great Reads

by Tomaz Koritnik
TmStorage is a structureless virtual file system from which complex storages or databases can be built.
by Mark Pelf
Beginner’s tutorial on PE format, with illustrations
by Lodewijk Pool
A quick and easy way to direct Java System.out to File and to Console.
by Mikhail-T
How to convert string to text file and return it back to user as a result of a controller action

Latest Articles

by Mark Pelf
Beginner’s tutorial on PE format applied to .NET assemblies
by Mark Pelf
Beginner’s tutorial on PE format, with illustrations
by Michael Sydney Balloni
See how Rust stacks up against C-ish, C++, and C#
by Andreas "PAX" Lück
Investigation of PE file modifications performed by Microsoft Detours

All Articles

Sort by Updated

File 

29 Feb 2024 by Maxim Kartavenkov
To implement that you need to have the base program which performs an encryption your exe with the given password and create primary executable - let's call this application "Creator". In this application you specify the password and select an...
29 Feb 2024 by merano99
From the context, I understand that we are talking about Windows EXE programs that are to be protected with a password regardless of their location and computer. This would result in the following requirements: 1. creating password protection...
28 Feb 2024 by Richard MacCutchan
If you have no experience of creating such a program then it would probably take many months to create your own version. And since the Exelock program already offers this feature, I suggest you use that.
28 Feb 2024 by Uzbek Tv yangiliklari
I have no any idea on creating a gui program that locks an exe file with given password by user, and when user tries to open that exe app, a form should appear and ask for the password to open that exe app for user, no matter the exe file's name...
15 Feb 2024 by Skynet1970
I rebuilded it an now it works => public static class ExtractZipFileHelper { /// /// Extract zip file for Azure fileshare folders (cloud directory). /// /// ...
15 Feb 2024 by Skynet1970
I have a Azure fileshare directory with a zip file, lets say abc.zip. I want to unzip this with C# code in a C# Azure function. What I have is the right filled CloudFileDirectory. Now I want to call a method that unzip the file thats is in this...
24 Nov 2023 by PinkGoat_
So I have a button made from my xaml file (view), called Export. When the user clicks on it, the logs created during the run of the app get exported to Logs.txt. If there are Warnings, Errors or Exceptions, those will instead be created in...
24 Nov 2023 by Graeme_Grant
The best solution, IMHO, would be to create a custom log provider. You can then handle the logging as the log entries are added. I wrote an article for a custom Log Viewer control that has a custom Log Provider, one for each of the 4 common...
23 Nov 2023 by Richard MacCutchan
See my comment to your duplicate of this question.
23 Nov 2023 by PinkGoat_
I'm having some issues here. So I wrote this method in a class named MainWindow, that exports logs of an app to a txt. Honestly I dont know if its good but anyways we will see. public void exportLogs () { string logsFolder =...
13 Sep 2023 by Member 16091704
I do not understand which folders and files to upload to the hosting in what form (in the picture of the folder with my site). I was making a Python website with two applications and now I don't understand which files need to be downloaded. What...
12 Sep 2023 by David Edwards 2022
I want to open a picture that I have highlighted when I open a C# program that will show that picture. The best example would be RARzip. You can highlight the files you want to add to an archive then start Rarzip and it will grab those files for...
11 Sep 2023 by Gerry Schmitz
You're switching between a "picture" and "files". In the case of a "picture": right click the image and copy it to the clipboard. Retrieve the image from the clipboard with your program. Clipboard.GetImage Method (System.Windows.Forms) |...
11 Sep 2023 by OriginalGriff
WinRAR and WinZip don't do that: You highlight the files in Explorer and then tell explorer to open WinZip or WinRAR - Explorer then adds the files to the "command line arguments" part of the application startup, and you can pick them up in your...
25 Jun 2023 by Leonel Gonzalez
estoy intentado obtener el url de un archivo guardado en mi carpeta de google drive file stream pero no he podido. alguien sabe por donde puedo iniciar? ---------- I am trying to obtain the URL of a file stored in a folder of my google drive...
25 Jun 2023 by Sandeep Mewara
You can use Google drive api's for such operation. In your case, you seem to need the list of files on drive such that you can specifically choose a file and thus the url for reference: Method: files.list �|� Google Drive �|� Google for...
12 Mar 2023 by FKV3
I have a file with hex values saved as sample.txt which has 0x5f05 0x3c75 0x9c53 the file can have more hex values (i dont know the exact number of the hex values). Now I need to convert it to a unsinged short int array as unsigned short int...
12 Mar 2023 by User 2753469
You might try iterating over the strings with isxdigit() function which will only consider hex digits 0-9 and a-f/A-F, (case doesn't matter). Then convert each char digit returned by isxdigit on each iteration. See the man page, string chars...
10 Mar 2023 by Mark Pelf
Beginner’s tutorial on PE format applied to .NET assemblies
10 Mar 2023 by Mark Pelf
Beginner’s tutorial on PE format, with illustrations
25 Feb 2023 by John Smith 27
In the program Ditto which is a clipboard manager, there's an option to run ChaiScript when the user changes the clipboard of Windows, so I want to run a short sound so I know the Ctrl+C or with the mouse worked correctly and I copied what is...
24 Feb 2023 by Krishna Chaitanya Bezawada (Chaitu)
Hi, I have a requirement such that if a file in particular path is deleted, then my program should kill an running exe program and sleep for 5 minutes so that my software will automatically start the same exe again. When the file is present in...
24 Feb 2023 by RickZeeland
In addition to Griffs advice: another option might be to use the FileSystemWatcher Class (System.IO) | Microsoft Learn[^]
24 Feb 2023 by OriginalGriff
Add a flag which says "I have killed the external process". Set it to true when you kill it, and false when the file exists. Then all you have to do is check it just before you try to kill the EXE. The advanced version stores and restores the...
19 Feb 2023 by l o o l
@echo off cd /d "C:\Users\eddyw\Desktop\PAC_PNL Misc\PAC-MISC" pushd "C:\Users\eddyw\Desktop\PAC_PNL Misc\PAC-MISC\Test_Files" for %%i in (*.PAC)do PAC-MISC.exe -d . "%%~nxi" popd I have a feeling that the program already handles its argument...
18 Feb 2023 by Eddie Winch
Hi there, I have the following line of Code in a Batch File :- set "SourceFolder=C:\Users\eddyw\Desktop\PAC_PNL Misc\PAC-MISC\pacbob1940" for %%a in ("%SourceFolder%\*.PAC") do PAC-MISC.exe -d Test_Files "%%a" The Batch File runs a C...
10 Feb 2023 by Richard MacCutchan
You have a space character in the directory path, which will cause the path passed in the for statement to be interpreted as "C:\Users\eddyw\Desktop\PAC_PNL". Try changing the set statement to the following, removing the double quote in front of...
10 Feb 2023 by Dave Kreskowiak
First, the SET statement does not need the quotes around it at all. Next, the problem is going to be with the command you're running as part of the FOR statement, or the batch files ability to find the command. Is the batch file in the same...
5 Jan 2023 by Michael Sydney Balloni
See how Rust stacks up against C-ish, C++, and C#
2 Jan 2023 by Rick York
You can use strtoul[^] to convert strings to unsigned integers. fgets[^] can be used to read strings from the file. The page has sample code for doing that.
2 Jan 2023 by Graeme_Grant
A quick google search: c convert string hex to binary - Google Search[^] found many results, like: How to convert a hexadecimal string to a binary string in C[^] . If not happy with this one, there are many others to choose from.
29 Dec 2022 by Richard MacCutchan
Quote: I'll be thankful to you if you design such an app/program although it is not difficult at all. Well, this site is not here to design your application for you. and although you seem to think this would not be difficult, I think you need to...
29 Dec 2022 by Muhammad Hamza Dec2022
I'm a student. I'm trying to make an app/C++ program that can acknowledge a user and when a 2nd person uses the same identity, it should deny. Like as an organizer of events, someone filled out a Google form to attend my event after paying (and...
29 Dec 2022 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
28 Dec 2022 by عصام مجدي السيد عبدالفتاح G 7 2022
I have 15 text files includes articles about different topics and I have another 5 text files each one includes token words about one topic politics, sports, weather, literature, history I want full (not just a sample) C++ code that read the five...
28 Dec 2022 by CPallini
As far as I can understand, the "classify each text file based on the token files" is wrong. There you should compute the frequency of the words in the articles (that is, for each article, create a map similar to the one used for the token files)...
28 Dec 2022 by OriginalGriff
Quote: this the output but i can not find the problem, it run with out any syntax error : text0.txt classified to token0.txt text1.txt classified to token0.txt text2.txt classified to token0.txt text3.txt classified to token0.txt text4.txt...
25 Dec 2022 by Member 8840306
I want to read file if the following pattern. Here is file1.text Abc,192.168.99.4 Eyo,192.168.8.16,3370 Opa,4447 Ctc,192.168.66.2,5507 Here is my code that is working for single , . Var3 is not displaying any...
25 Dec 2022 by OriginalGriff
fscanf[^] doesn't support regular expre3ssions - it supports character classes which are a much, much more limited form. These character classes do not include an OR operator. Remember that C predates Regular Expressions by several decades: you...
25 Dec 2022 by Member 8840306
I am new in C. I am using C with QT-4. I am trying to write the text file having two colums . Here is my text file that is space separated hi Name hi Grade DDD Class EEE Grade2 BBB Class3 ky Grade3 DDD Class4 EEE Grade4 Here is my code ...
25 Dec 2022 by OriginalGriff
You are trying to write to the file while you read from it: that only works if the data lines are all exactly the same length, and you seek to the right position each time you want to read or write: mixing reads and writes in a normal text file...
25 Dec 2022 by Rick York
First there are few problems with your code. Before addressing those, here are a few other things I would do. First, define a type for the strings you are using. : const int StrSize = 49; typedef char textStr[ StrSize + 1 ]; The +1 is used so...
21 Dec 2022 by Member 8840306
I am new in C++. I am using C++ 98.Here is my code. It is getting the text from a `lineEdit` of a Qt4 form. strcpy(Name,ui->lineEdit->setText(QString::fromStdString(Name)) );...
21 Dec 2022 by CPallini
Do you mean 'align the columns without using tabs'? If that is the case, then you have to read the file twice: the first time for finding the maximum column lengths. The second time to produce the output, using the appropriate number of blanks.
9 Dec 2022 by salam_verdim_alana_panyatkasi_olana
I'm talking about docker right now. I was wondering why there are not only images but also containers here? I understand that container that runing from instance of image. Okay, we get that, so why do we need this separately? Wouldn't it be right...
9 Dec 2022 by Afzaal Ahmad Zeeshan
Your question is unclear. The computer world has more than 2 things—while bit states can be only 2; 0, and 1. The concept of images and containers is the same as class and objects. You write the class in your Java file, and when that code runs,...
5 Dec 2022 by Devendra Sarang
I am opening a folder using OpenFileDialog in vb.net but before opening it, i want to check whether it has permission to open or not. I am already checking whether folder exist or not using System.IO.Directory.Exists(Directory) Now if...
20 Nov 2022 by Graeme_Grant
Here is how I would approach it: 1. Define a class with the properties: Name, Gender, Status, Condition 2. Define a list/array to hold a collection of the class 3. Open first file and load the list 4. Open second file and update the list 5. Write...
20 Nov 2022 by Pococurante Bird
Hello there, I have two different file. File1.txt Name Gender Status Messi male single Ronaldo male single Speed unknown unknown File2.txt Name condition Messi 1 Ronaldo 1 Speed 10 ...
3 Nov 2022 by Abishek Samuel
Any Ideas to prevent duplicate entries in every execution of a program in a same text file. Thanks in Advance :) What I have tried: Still searching for good ideas :(
3 Nov 2022 by Rick York
I had to do something like this just today. What differed was I was comparing two directories and listing the files that one directory was missing but it was essentially exactly what you need to do. I made a list of all the files in the "base"...
3 Nov 2022 by OriginalGriff
The only way to check is to read every entry in the text file, and check each and every one of them. Text files on their own don't have any organisation - not even lines - so you can't add "extra info" like a hash value to make the process...
3 Nov 2022 by k5054
You're going to have to read the text file in to know whats there. If the file is "small" (compared to available RAM), then you might use a std::vector or a std::map to store the contents. If the file is "large", then you might need to scan...
28 Oct 2022 by Abishek Samuel
I need to access the second column directly or iteratively. ```[ { "Player_no": 2, "player_name": "Warner", "team": "Aus", "age": 33 }, { "Player_no": 3, "player_name": "virat", "team": "India", "age": 30 ...
28 Oct 2022 by Graeme_Grant
NOt familiar with that lib, so I did a quick Google Search: rapidjson example - Google Search[^] and found this: RapidJSON: Tutorial[^]
29 Sep 2022 by 梅君
I want to wipe all file in a folder. So I use CFile class to open a volume. Then parase the MFT and data to be wiped of files.MoveFile(lpszCurFilePath, lpszReplacedFilePath);// Use Window API to delete the fileif (!DeleteFile(lpszReplacedFilePath)) return;...
29 Sep 2022 by OriginalGriff
Just thought I'd mention that writing over a file doesn't delete it totally, or even close. If you are using an SSD, then the data is not overwritten at all - the new data is written to a free block and the old data remains in the old block for...
17 Aug 2022 by Member 15739974
please help me! my code: ff="my_file.txt" file =open(ff,"r+") text=file.readline(2) file.close() print(text) the real value of my text is 1769.65 but output is : ÿþ why the value is changed? What I have tried: If you have a solution, please...
17 Aug 2022 by OriginalGriff
Use a binary editor to look at your file data - it will show you the "raw byte values", probably in hexadecimal. If it is numeric text, each hex byte will be in the range 30 - 39, which correspond to the characters '0' to '9' respectively (the...
26 Jul 2022 by Elsa kasaw
how can we integrate OWL Protégé file to Java Netbean What I have tried: pls help me on how can we integrate OWL Protégé file to Java NetBeans
26 Jul 2022 by Richard MacCutchan
See Protege Wiki[^] for details on usage.
6 Jul 2022 by Member 15078716
Oops. Did not mean to keep this question, but if someone wants to answer, nicely, then that is OK. I have two ways that I am looking at the file length. Which is better? Use: If I want to update some software for my uncle's old saw...
5 Jul 2022 by CPallini
The first approach is correct. The second one is a blunder. From GetFileSize function (fileapi.h) - Win32 apps | Microsoft Docs[^]: [out, optional] lpFileSizeHigh A pointer to the variable where the high-order doubleword of the file size is...
5 Jul 2022 by Dave Kreskowiak
There are no problems with GetFileSize and GetFileSizeEx on machines. The difference between the two is GetFileSize will only return an unsigned, 32-bit value, thus there's a limit to the size of the file it can return, 4,294,967,295 bytes. The...
29 Jun 2022 by Member 12906506
what is the difference between Database acess component and file acess component?i did not get any answers relted to file access component so i asked it to u guys help me if u know any of this?It is related to asp.net and I need answers in terms of ADO AND FAC.What I have tried:I have...
29 Jun 2022 by Sam Abiola
The data access component exists within the data tier and serves as the middleman between the underlying database and the business objects while the File Access component uses the FileSystemObject and TextStream objects to retrieve and modify...
1 Jun 2022 by HubSnippets
What kind of computer language is used to write this code below?@ echo off:AClsecho Messengerset /p n=User:set /p m=Message:net send %n %mPauseGoto AAlso, what language do I need to understand to write windows system files like the ".bat" file.
12 May 2022 by dejf111
Hi, I'm trying to create a path where I would save the newly created layers, but I have a problem with how to enter the path to the folder that contains the file I'm copying but I want to rename it. It occurred to me to cut it off, but it's...
12 May 2022 by OriginalGriff
Use the Path.GetDirectoryName Method (System.IO) | Microsoft Docs[^] It returns the full containing folder with no associated filename.
25 Apr 2022 by A v Nov2021
Input in a text file : Combination: 1 . 1 . 1 . 1 var_a: 33 op: -9.234727046103648 Combination: 1 . 1 . 1 . 2 var_a: 31 op: -9.234270216065962 Combination: 1 . 1 . 1 . 3 var_a: 39 op: -9.233204788566372 Combination: 1 . 1 . 1 . 4 var_a: 50 op:...
25 Apr 2022 by CPallini
There is a way simpler than using regular expressions: you can split every line, using ":" as separator, e.g. line = "Combination: 1 . 1 . 1 . 1" l = line.split(":") print(l[1]) outputs 1 . 1 . 1 . 1
25 Apr 2022 by Richard MacCutchan
You should create a list of tuples from the inputs. Read each set of three lines, and extract the values. Create a tuple of these values and add it to the list. Once you have all the data you can write it out to a .csv file. See 7. Input and...
21 Mar 2022 by Réda 2022
I have to write a code to check if an ID already exists in a file. What I have tried: This is the code i wrote : printf("Please enter the ID of the student : "); scanf("%d", &newstudentID); printf("\n"); input=...
21 Mar 2022 by k5054
So we have scanf(%d, &newstudentID) so presumably newstudentID is of type int. Then a bit later we havestrcmp(newstudentID, buffer) Here, we are passing an int to strcmp as the first argument, but strcmp() is expecting a char *. So strcmp()...
11 Feb 2022 by DoingWork
I want to start 2 applications with one shortcut. One application is GUI based while other is shell based (Terminal=true in .desktop file). What I have tried: For this goal, I created a file name **Starter** having following script in this...
6 Feb 2022 by Member 15525124
// Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo ""; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "The file "....
6 Feb 2022 by Richard MacCutchan
I also noticed a very similar set of questions from yesterday by Member 15524347 - Professional Profile[^]. Is that you or someone working with you? If it is you then please close the account that you are no longer using.
6 Feb 2022 by Member 15525124
heres the code im having problems with "...
6 Feb 2022 by Richard MacCutchan
The same issue as in your other question, the names you are using are not valid.
6 Feb 2022 by Richard MacCutchan
Again, you need to read your code more closely: rename('../Chat/uploads/'.["fileToUpload"],'../Chat/uploads/'.$username); Look at the name you are using as the source file to be renamed, there is no such name. And you should check the result...
24 Jan 2022 by Andreas "PAX" Lück
Investigation of PE file modifications performed by Microsoft Detours
24 Jan 2022 by Member 15511449
I have a txt file with 4 by 3 rows and columns of numbers but there is some empty lines (space) in some places, and I am supposed to print the average of each row and column (which I already did) but when I come across an empty line I have to...
24 Jan 2022 by Luc Pattyn
"1" is a string containing a single digit " " is a string containing a single space "" is an empty string
14 Jan 2022 by CHill60
You need to read the documentation or talk to the community at Shopify Community · Shopify Help Center[^]
14 Jan 2022 by Maximilien 2022
How can I retrieve a file that I have asked a user of my site to upload? I would like to ask users to send me MP3 files on SHopify. How can I code this. What I have tried: I tried using the Fetch command but I don't understand a thing about...
7 Nov 2021 by dejf111
Good day, I do a text search in in file in the WPF application, which I would then rewrite. I'm completely confused about what to write as a rewritten value. The problem is that the found lines are overwritten, but depending on the number of them...
7 Nov 2021 by OriginalGriff
That's not going to work. I'm not at all sure what you expect it to do, but it's not going to do it. for (int index = 0; index
5 Nov 2021 by dejf111
Good day, I have a question about rewriting the text in the line I'm looking for. The code works if I write the line number, but as soon as I try to find the line number, I don't know how. I will be happy for any advice and help. Thank you...
5 Nov 2021 by Richard Deeming
Use a for loop instead of a foreach loop, and only write the updated content back to the file outside of the loop. for (int index = 0; index
4 Nov 2021 by dejf111
Hello, the name of the question was not entirely chosen, but I did not know how to summarize it in a short version. So the question is, how to find the file (s) by part of the name? Then to sort only the searched extension (csproj) from the...
4 Nov 2021 by OriginalGriff
Try this: List files = new DirectoryInfo(@"C:\TopLevelFolderPath").EnumerateFiles("SH*.*", SearchOption.AllDirectories).Select(d => d.FullName).ToList(); That will find all files starting with "SH" in the TopLEvelFolder or a subdirectory.
4 Nov 2021 by phil.o
Chances are, it only searches in the root directory. TryFileInfo[] filesInDir = hdDirectoryInWhichToSearch.GetFiles ( $"*{file}*.csproj", EnumerationOptions.RecurseSubdirectories );
27 Oct 2021 by Member 14925860
I am comparing all files in two directories, if comparison is greater than 90% so i continue the outer loop and i want to remove the file in the second directory that was matched so that the second file in the first directory doesn't compare with...
26 Oct 2021 by OriginalGriff
This is a repost of your question from some days ago: Sending messages to phone numbers[^] The answer hasn't changed in the meantime.
25 Oct 2021 by User 15367957
StreamReader stream = new Strear(bulkfile); } What I have tried: This code reads URL's from a text file and then gets the response and displays it
23 Oct 2021 by Richard MacCutchan
Look at your code, you set the textbox to the HTTPResponse for a URL. But then next time round the loop you do the same. So after processing all URLs the only data you show is from the last one processed. You need to append the response to the...
19 Oct 2021 by Pablo Romanelli
I´m learning programming in phyton and i had to make a wordsearch generator. Ive made it but i need the result/array to be saved in a csv file. Ive tried a lot but cant seem to find out how, anyone can help me please? Thanks in advance. Sorry for...
19 Oct 2021 by Richard MacCutchan
See csv — CSV File Reading and Writing — Python 3.10.0 documentation[^]
14 Oct 2021 by Dave Kreskowiak
Look at what you appear to be doing: String phoneNumber = ""; String textMessage = ""; FileInputStream excelFile = new FileInputStream(file); Path sourcePath = Paths.get(String.valueOf(file)); Path targetPath =...
14 Oct 2021 by User 15041314
This is my code, which accept generally .xlsx format file and insert to database and also move accept file to my specified folder. When I trying to move it, I have getting this error: Normally, it successfully writes the received excel file to...