Ask a question

Can Someone Give A Sample Code Of How I Can Delete Data To A Text File

How to delete the last line of text using batch?

This does it in 2 passes. File is read to count the lines, then file is read again to output all but the last line. It could probably be done in a single pass, but doesn't seem worth the extra effort.
Lines are written to a temporary file, then the original file overwritten at the end.

@echo off
SETLOCAL ENABLEDELAYEDEXPANSION

rem Count the lines in file
set /a count=-1
for /F %%a in (list.txt) DO set /a count=!count!+1

rem Create empty temp file
copy /y NUL tempfile.txt >NUL

rem Copy all but last line
for /F %%a in (list.txt) DO (
IF /I !count! GTR 0 (
echo %%a >>tempfile.txt
set /a count=!count!-1
)
)

rem overwrite original file, delete temp file
copy /y tempfile.txt list.txt >NUL
del tempfile.txt

rem This for testing
type list.txt

How do I recover deleted files from Android internal memory?

Yes it is possible.If you are using unrooted android device , use:1. Dumpster:Dumpster Photo & Video Restore - Android Apps on Google PlayDumpster is a free Android recycle bin, for users prone to accidentally deleting device files and images. Once the recovery app has been downloaded, users can effortlessly undelete and restore device data.2. Diskdigger:DiskDigger photo recovery - Android Apps on Google PlayWorks same as dumpster but it has some special features for rooted users.If you are using rooted android phone, use:3. Undeleter:https://play.google.com/store/ap....Its awesome. You can also use it in Non rooted devices.*** If want to recover more - like accidentally deleted contacts, messages, audio, video, documents or even whatsapp messeges, you have to rely on a pc software :4. Wondershare Dr. Fone:Android Data RecoverySteps to use :° Enable Developer options(Settings >> about phone >> tap on build number 7 times)°Connect your android phone to your pc with "USB DEBUGGING" enabled(Settings >> developer option >> usb debugging)° Once done. You are good to go. Follow the instructions as appear on your pc screen. :)***If this helped. Plz upvote :)

Can someone help me with these methods on exception java? I don't understand?

Now implement a method reverseSequences that takes two Strings as parameters. The first String is the name of an input file containing String values and the second is the name of an output file to write the reverse sequences to. The method should read sequences from the input file one sequence at a time using getSequence and then write them out to the output file. Do not forget to close the output file when the method is finished. Make sure you catch and handle the possible IOException exceptions.
public static void reverseSequences(String inputFile, String outputFile)

Now implement the method summarizeSequences that takes a String as a parameter. This method should open the file named by this String, and read a sequence from that file into an array list using the getSequence method you wrote above. It should then display on a single line the first, last, and middle String in the sequence (if the list is even, the position of the "middle" String is the size of the list divided by 2). Make sure you catch and handle the possible IOException exceptions.
public static void summarizeSequences(String fileName)

A Function in Data File handling... C++?

I don't know how to inhibit the Yahoo software from
left justifying every line, so the lack of indentation
will make this hard to read. The code is really "C",
but it compiles and runs just fine under a C++ compiler.
Change the "fprintf(outfile" to "outfile<<" if you prefer.

In any case, "strtok" from the ANSI C library makes
this pretty straight-forward.

#include
#include
#include

int
main(int argc, char* argv[])
{
char buff[1000], *p, *t;
FILE *in = fopen("FIRST.TXT", "r");
FILE *out = fopen("SECOND.TXT", "w+");
if (!in || !out)
perror("fopen"), exit(-1);

while (fgets(buff, sizeof(buff), in)) {
p = buff;
while (t=strtok(p, " \t")) {
p = 0;
if (*t=='a' || *t=='e' || *t=='i' || *t=='o' || *t=='u')
fprintf(out, "%s ", t);
}
fprintf(out, "\n");
}
return 0;
}