delete « delete « C File Q&A

Home
C File Q&A
1.array
2.binary
3.delete
4.Development
5.directory
6.fgets
7.fopen
8.fprintf
9.fscanf
10.fwrite
11.header
12.include
13.input
14.LINE
15.linux
16.open
17.output
18.pointer
19.read
20.size
21.string
22.struct
23.Text
24.windows
25.write
C File Q&A » delete » delete 

1. is there any basic way to delete something from opened file    stackoverflow.com

When you open a .txt file with fopen Is there any way to delete some strings in a file without rewriting. For example this is the txt file that i will open ...

2. Delete a file in C    stackoverflow.com

I have written a program that manipulates files and I sometimes to delete a file. So I searched and found the remove() function in the stdio header file in C. The ...

3. How can I delete a file pointed to by a FILE* in C?    stackoverflow.com

#include<stdio.h>

int main() {

    FILE* fp;
    fp = fopen("temp.txt", "w");
    fprintf(fp, "Hello, World!\n");

    // remove("temp.txt");  this requires the filename ...

4. Detecting file deletion after fopen    stackoverflow.com

im working in a code that detects changes in a file (a log file) then its process the changes with the help of fseek and ftell. but if the file get ...

5. Delete End of File    stackoverflow.com

For instance if I called WriteFile to the end of a file, and later I wanted to delete the written bytes, how could I do this? Do I have to read ...

6. C: Search and Replace/Delete    stackoverflow.com

Is there a function in C that lets you search for a particular string and delete/replace it? If not, how do I do it myself?

7. ANSI C - Execute Process, Wait, Delete File    stackoverflow.com

I am trying to execute LP to print a PDF document and wait for it to exit. After it exists i am trying to delete the file with unlink(); However the wait finishes ...

8. Recover a deleted file using undelete() in C    stackoverflow.com

I'm just trying to recover a file in C on an HFS+ formatted Volumn. According to

man undelete
NAME undelete -- attempt to recover a ...

9. Delete Folder + Files    bytes.com

10. Delete chars in a file stream    bytes.com

On Jun 13, 10:40 am, "Bernie"

11. ifstream: reopening a file after it was renamed/deleted    bytes.com

Hello, I was looking for a solution on http://www.cplusplus.com/ and serched groups, but cannot find anything interesting. My program opens an input file stream: ifstream f( "in.txt" ); then goes to its end: f.seekg( 0, ios_base::end ); and then, in a loop, waits for a new line to be put into this file, and reads it: string line; while( true ) ...

12. Deleting a file? Need help...    bytes.com

Hello, I am pretty new to C++, and I have a question: I am, and have been using Dev-C++ I used this code, to delete a text file on my desktop. The first time around, it worked perfectly. Given the file example name of "dafile". #include // needed to use system() function int main() { system("del dafile.txt"); return 0; } ...

13. deleting part of file and modyfing it    bytes.com

I didn't go throught your code in detail, but roughly know what you want to do. First of all, for efficiency wise, i want to advice you to pass in the pointer of the structure to the function instead of passing the whole structure one at a time. check this out. Do you mean that you want to update the value ...

14. Delete file on program exit/close    bytes.com

15. how to delete a file?    bytes.com

16. Creating and deleting temp files    bytes.com

17. add/delete files in C    bytes.com

Hi, I hope someone can help me out here. I have this project where i'm supposed to write a program that takes in a user's id which (s)he enters on a web page, through CGI the page is linked to a C program that does a few calculations and according to that displays back on screen a certain amount of files ...

18. Help needed in regarding to deletion of a file......    bytes.com

Hi every body. i'd write a program to copy the content of one file to another file and to delete the content of the first file. But after deleting the first file remains the harddisk(even though it has no data in it). i want to remove the file totally from the harddisk. How to implement this. I'd written the program in ...

19. File still using by...cannot delete.    cboard.cprogramming.com

Code: #include #include void write(); void del(req_year); void read(); struct product { char code[5]; int year; char country[25]; } ; struct product p; int main(void) { //write(); read(); del(); } void write() { FILE *file1; char choice; file1 = fopen("product.dat", "rb"); do { fflush(stdin); printf("Input product code: "); scanf("%s", &p.code); fflush(stdin); printf("\nInput product expired year: "); scanf("%d", &p.year); fflush(stdin); ...

20. delete some byte from a file    cboard.cprogramming.com

The "best" way would be to use a tool other than C, such as Perl, or Sed or Awk. You could do this in a single line. However, if you are bent on using C then you will need to hack it a bit and get what you want. This usually means reading the whole file in, finding what you don't ...

21. Deleting content from a file    cboard.cprogramming.com

22. Main file deleted    cboard.cprogramming.com

23. deleting numbers in files    cboard.cprogramming.com

24. delete file in another folder    cboard.cprogramming.com

25. how to delete several files at once?    cboard.cprogramming.com

26. Deleting something on FILE I/O    cboard.cprogramming.com

#include #include #include void changer(char *first,char *exchanger) { int i,x; for(i=0,x=0;first[i]=exchanger[x];i++,x++); } int main(void) { char buffer[100]; char exchanger[]="http://www.onemanga.com"; FILE *fp; int i=0; fp=fopen("D:\\test\\lol.txt","r+w"); fp2=fopen("D:\\test\\lchanged.txt","w"); while(fgets(buffer,sizeof buffer,fp)!=NULL) { puts(buffer);//for test to see if it changed it or not if(strstr(buffer,"http://www.narutocentral.com")) { changer(buffer,exchanger); puts(buffer);//so here it got changed but in txt it didnt !!! so WTF ??? } } return ...

27. delete file(s) using path and name    cboard.cprogramming.com

28. Deleting multiple files using C    cboard.cprogramming.com

I think you managed to misunderstand EVERY SINGLE reply. In summary: 1. You should not use feof() to control the loop - you will most likely run one more loop than you actually want - so you will try to delete the last file twice. Not quite as bad as adding an extra record to a database, but still absolutely not ...

29. C Delete opened file    cboard.cprogramming.com

Hi, I am in the early stages of learning C (previously coded in java, PHP etc.). The code below is a simple menu which enables you to: create, delete, open and close a file. The problem i have is if you choose to create the file, then open it, it is then not possible to delete it (gives error 32). If ...

30. Delete files and subfolder using c programing (Urgent    cboard.cprogramming.com

#pragma comment( lib, "shell32.lib" ) #include #include #include BOOL DeleteDirectory(char *pSource) { SHFILEOPSTRUCT sh; ZeroMemory(&sh, sizeof(SHFILEOPSTRUCT)); sh.hwnd = NULL; sh.wFunc = FO_DELETE; sh.pFrom = pSource; sh.fFlags = FOF_NOCONFIRMATION | FOF_SILENT; return !SHFileOperation( &sh ); } int main(void) { if(DeleteDirectory("C:\\TEMP") == FALSE) printf("Temp folderNOT deleted\n"); else printf("Temp folder deleted Successfully\n"); return 0; }

31. can not delete a file    cboard.cprogramming.com

remove_non_empty_directory ("c:\\temp\\non_empty_dir\\*"); // ErrorExit implementation from MSDN // http://msdn2.microsoft.com/en-us/library/ms680582.aspx int remove_non_empty_directory (const char* path) { WIN32_FIND_DATA FindFileData; HANDLE hFind; int rtn; hFind = FindFirstFile(path, &FindFileData); if (hFind == INVALID_HANDLE_VALUE) { FindClose(hFind); return -1; } else { // delete 1st file rtn = DeleteFile(&(FindFileData.cFileName)); if (0 == rtn) { ErrorExit (NULL); } // List all the other files in the directory and ...

32. delete the file contents    cboard.cprogramming.com

Hi All, I would like to delete the specific lines in a file programmatically, is there any way I can do that? Similar to the one we do it in notepad i.e. as soon as we delete a line the line below the deleted line would occupy the current position. Thanks in advance

33. delete multiple files    cboard.cprogramming.com

34. Newbie Deleting a file    cboard.cprogramming.com

I just tried it again, and it compiles without problem.. as a commandline .exe, But does not give the same error..... Yet the test object is still not deleted.... So it just ignores it. If i add the almost identical code, to my plugin (a .dll) It instantly crashed, my plugin and it's host..... It gave me a warning not an ...

35. compare and delete data from file    cboard.cprogramming.com

<#include > <#include > <#include > <{> <{> <} >

36. how to delete a file?URGENT!!!!!    cboard.cprogramming.com

37. deleting a file    cboard.cprogramming.com

38. How to delete a file?    cboard.cprogramming.com

39. Deleting files.    cboard.cprogramming.com

40. deleting a structure from a file    cboard.cprogramming.com

In my delete func() I have noted where I need a func() to delete a selected structure. I have looked in every book I have and can't find an example to go by anywhere. Also, in my add_record func(), I need to be able to verify that the client_code has not already been used. Again, couldn't find any examples to help. ...

41. need help deleting a deleting a struct from file    cboard.cprogramming.com

42. How to delete a File?    cboard.cprogramming.com

43. Deleting a file in C    cboard.cprogramming.com

44. How to delete more than one file Csharp    forums.devshed.com

45. How to delete a file itself..    forums.devshed.com

46. Delete file    forums.devshed.com

47. Delete file    forums.devshed.com

The Win32 API does have a DeleteFile() as well as a CopyFile, a MoveFile, a CreateDirectory, and a RemoveDirectory. The more traditional functions are more OS-dependent. Traditionally, the command to delete a file was unlink(). The reason for the name is because it comes from UNIX where you can create any number of symbolic links to the same file or directory, ...

48. Deleting element in a File (C)    forums.devshed.com

General procedure: Open original file for reading. Open a temporary file for writing. Going one line at a time, read a line from the input file and, if it is not one of the ones you want to delete, write it to the output file. After you've read and possibly written the last line, close both files. Delete the original file. ...

49. Deleting data in the middle of a file    forums.devshed.com

50. path deleted file    forums.devshed.com

path deleted file dear forum i have a project to make NTFS file recovery in my university. i have found deleted file in MFT but i can't find the path. any one can help me to find the path, example the deleted file in c:\folder\ here my source code Code: //in ntfs.h typedef struct { ULONG Type; USHORT UsaOffset; USHORT UsaCount; ...

51. Deleting a file using a handle    forums.devshed.com

It doesn't need to... Consider the following: A file handle is valid only if the OS could give you access to a file(read/write)... and the OS mantains a list of currently opened file handles so if you try to delete any file referenced by a handle the OS will complain. The DeleteFile function is probably assuming that there is no handle ...

52. deleting from a file    forums.devshed.com

53. Force delete a file    forums.devshed.com

Hi all, I want to know: can we delete a file after I know that remove function has failed (that is sort of force delete). When I try to do a force delete from DOS prompt it gives me the error that its in use by another process (del /F filename.ext). Alternatively, even if I get to know as to how ...

54. Deleting files    forums.devshed.com

55. Delete Files    forums.devshed.com

Well, in C or C++ doesn't matter, but I need a script to delete files & directories, I'm sitting in the school and it is illegall to have some programs, files. So it will be good to have a program to delete some files. The program shall also be able so you can write which file, firectory that shall be deltet, ...

56. Restoration 2.5.14--how does it expunge previously deleted files?    forums.devshed.com

i have this awesome freeware program called Restoration (version 2.5.14). it has a very unique function that allows you to delete the list of previously deleted files... for example.. you can search for deleted files to recover them.. but you can also somehow that i have no idea how the program does it, obliterate these file names and other data about ...

57. How do u delete i/0 files after making them???    forums.devshed.com

58. deleting from a file    forums.devshed.com

Read the file starting at the begining writing the characters you want to keep to a new file, skipping the ones you don't want to keep, deleting the old file and renaming the new one. There are more efficient ways to accomplish this, but they are all basically the same. You can change the contents of a file, you can even ...

59. Deleting real long file names    forums.devshed.com

... WCHAR ucStrBuffer[MAXPATHSIZE]; if( ! MultiByteToWideChar(CP_ACP,0,dFileName,sizeof(dFileName),ucStrBuffer,sizeof(WCHAR) * MAXPATHSIZE) ) MessageBox("MultiByteToWideChar returned with 0", "Techmenu: Lschung",MB_OK); //gfaRet = GetFileAttributes(dFileName); gfaRet = GetFileAttributesW(ucStrBuffer); if( gfaRet != INVALID_FILE_ATTRIBUTES ) { SetFileAttributes(dFileName, FILE_ATTRIBUTE_NORMAL); gfaRet = gfaRet & FILE_ATTRIBUTE_DIRECTORY; if( gfaRet ) { if( ! this->XDelDirectory(dFileName) ) { SetCursor(lhCursor); return FALSE; } } else { iRet = DeleteFileW(ucStrBuffer); } ...

60. Deleting a file    forums.devshed.com

61. delete file from within the program    forums.devshed.com

Hi all! First off, happy new year to u.. I am writing a program under Linux designed to make a USB camera capture images, with KDevelop. The "instructions" or guide to writing the program can be found here: http://bytesex.org/v4l/spec/index.html I want the camera to capture images continuously, which I have accomplished but I also want to check that the memory is ...

62. Simple Question: Deleting Files In Working Dir    forums.devshed.com

63. delete least recently used file?    forums.devshed.com

64. Deleting several chars in the end of a file    forums.devshed.com

The best, simplest, most reliable and easiest to debug way is to make a copy. I think there are other OS specific ways to shrink files in place, but it is trivial (unless, of course, you are at your limit on file space or the file is huge) to make a copy.

65. deleting/editing file using "fwrite" garbage value left!!!    daniweb.com

main(void) { FILE * fp,* fw; char * line = NULL; size_t len = 0,len1=0,len2=0; char src[55],new_src[55]; char port[6]; int i,j,k,count=0,pos=0; fp = fopen("conf.apf", "r"); if (fp == NULL) exit(EXIT_FAILURE); fgets(src,50,fp); len=strlen(src); printf("\nEnter port number to be replaced : \n"); scanf("%s",port); len1=strlen(port); printf("%s and length of string %d\n", port,len1); strncpy(new_src,src,len); for (j=0; j

66. Deleting First Row From Csv file    daniweb.com

#include #include int main() { FILE *in, *out; char ch; char *rdf,*wdf; int comma_count = 0; int wait_for_newline = 0; clrscr(); rdf="A:\\r.csv"; wdf="A:\\abl.csv"; in = fopen(rdf,"r"); out = fopen(wdf,"w"); if(in == NULL) { printf("Cannot open input file.\n"); exit(1); } if(out == NULL) { printf("Cannot open output file.\n"); exit(1); } while(!feof(in)) { ch = getc(in); if(ferror(in)) { printf("Read Error"); clearerr(in); ...

67. how to delete a file contained in argv    daniweb.com

hey guys, i was wondering if you could help me with my problem! i made a program that uses 3 arguments as inline commands: argv[0] is the name of the program) argv [1] is the name of the first file argv[2] is the name of the second file The purpose of the program is to write an inline command with these ...

68. Deleting a file    daniweb.com

69. Delete a File by Timestamp    codeproject.com

You have got to explain what you are doing. Is seems incredible that you just want to wander around your hard drive deleting files with certain file types that have been created recently. How did the file get created in the first place? Was it by some action on your part? How can it be that you do not know the ...

70. How to delete files in a folder?    codeproject.com

71. deleting files    tek-tips.com

72. Deleting a file.    tek-tips.com

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.