Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs

Dashboard
Notifications
Mark all as read

Activity for dumplingsā€­

Type On... Excerpt Status Date
Comment Post #285205 The problem I currently have now is that I'm not sure how to get user input and then strcmp() with the contents in the text file to delete that particular string containing the substring like what the user inputs. I also read on strstr() and gets() and implemented them but only manage to extract the ...
(more)
about 1 month ago
Comment Post #285303 But, once I found that line, how do I delete it? Is there some kind of built-in delete function to delete that particular line in the .txt file? I do see some coders creating a new temporary text file and store and rename it again but it seems quite hectic.
(more)
about 1 month ago
Edit Post #285298 Post edited:
about 1 month ago
Comment Post #285298 This is my question, I was the one who said "Hey I have a question" & "Thank you".
(more)
about 1 month ago
Comment Post #285298 I just wanted the question to be displayed in a box....
(more)
about 1 month ago
Edit Post #285298 Initial revision about 1 month ago
Question How can I modify the code above to accept string as user input and use strcmp to compare with the contents of the text file & then delete that line?
I want to enter a string to compare with the text file, and if that word matches, then I want to delete that line containing that string. How can I modify the code below, since the code below takes line number as input to delete a specific line. Thank you. ``` #include int main()...
(more)
about 1 month ago
Edit Post #285222 Post edited:
about 1 month ago
Edit Post #285222 Post edited:
about 1 month ago
Edit Post #285222 Initial revision about 1 month ago
Question Problems with data structures and filestreams.
So I just started learning how to use file-streams in C & decided to attempt a question which is to do with library management in C, however I am currently encountering some problems and feel like I need some help/advice. Basically, my file name is libraryy.txt, I want to delete a book that I have...
(more)
about 1 month ago
Comment Post #285218 I don't know how to remove the occurrence of the second string inside the first one...Do you happen to have any tips or advices or something?
(more)
about 1 month ago
Edit Post #285218 Post edited:
about 1 month ago
Edit Post #285218 Initial revision about 1 month ago
Question How to efficiently remove every occurrence of one string inside another
I have two strings and want to remove every occurrence of the second string inside the first one starting from the beginning of the first string and as if each occurrence was removed immediately. I would like to to so in C in a time efficient way, i.e. probably with the lowest number of comparison...
(more)
about 1 month ago
Edit Post #285217 Initial revision about 1 month ago
Question Can someone explain why is *f = 1?
Regarding a code I got from the net on calculating factorial, why is 1 assigned to f here? ```c #include void findFact(int,int); int main() { int fact; int num1; printf("\n\n Pointer : Find the factorial of a given number :\n"); printf("--------------------------...
(more)
about 1 month ago
Comment Post #285211 I did, but I don't understand it. If I did, I wouldn't need to ask it here. That's why I'm asking for others opinions on it.
(more)
about 1 month ago
Edit Post #285211 Post edited:
about 1 month ago
Edit Post #285211 Initial revision about 1 month ago
Question How do I display the book (its title, author & subject) from my libraryy.txt document by entering the title of that book on the screen?
> I want my compiler to display an output of the book contents (its title, author & subject) when I enter the title of that particular block in the compiler's output screen. However there seems to be in error & I'm stuck. Can someone help me out? Thanks, would really appreciate any help :") ```...
(more)
about 1 month ago
Edit Post #285206 Post edited:
about 1 month ago
Edit Post #285206 Post edited:
about 1 month ago
Edit Post #285206 Initial revision about 1 month ago
Question Why doesn't my deletefile() function work?
Question: Why doesn't my deletefile() function work. I have already also created a temporary file called TempFile. I want to delete specific contents in my "libraryy.txt" file (yes, it is called libraryy.txt NOT library.txt file XD) anyways, did I make a mistake somewhere in my deletefile() function?...
(more)
about 1 month ago
Comment Post #285205 But what if I for instance want to delete a specific content from the text file using c program? Is there some function that I can use as I do not want to clear ALL the contents, thanks!
(more)
about 1 month ago
Edit Post #285204 Initial revision about 1 month ago
Question How to clear the contents of a file?
How to clear the contents of a file using C?
(more)
about 1 month ago
Edit Post #285148 Post edited:
about 1 month ago
Edit Post #285148 Post edited:
about 1 month ago
Edit Post #285148 Post edited:
about 1 month ago
Edit Post #285148 Post edited:
about 1 month ago
Edit Post #285160 Post edited:
about 1 month ago
Edit Post #285160 Initial revision about 1 month ago
Question Is this the correct way of receiving data structures of pointers as an input?
How do you accept a data structure of pointer as an input? ``` #include #include //void addBook(struct library thislib){ //} int main (void){ FILE cfPtr; struct book{ char title; char author; char subject; }; int operation; if ((cfPtr = fopen...
(more)
about 1 month ago
Edit Post #285148 Post edited:
about 1 month ago
Edit Post #285148 Post edited:
about 1 month ago
Edit Post #285148 Post edited:
about 1 month ago
Edit Post #285148 Initial revision about 1 month ago
Question Regarding the implementation of data structures.
I'm attempting a question to do with data structures, file streams & linked lists. The code isn't complete yet as I am still halfway working on it. I am required to use data structures in the declaration section like so as shown in my code below. However, I'm still confused on what I should include i...
(more)
about 1 month ago
Comment Post #285136 Oh sorry, I actually did include the #include<stdio.h> its just that when I copied and pasted this code from my C compiler onto here, I missed it out. Maybe I'll try and see if there's any updates for my C compiler. I'm using code:blocks btw. I mean it should be fine right?
(more)
about 1 month ago
Edit Post #285135 Post edited:
about 1 month ago
Edit Post #285135 Post edited:
about 1 month ago
Edit Post #285135 Post edited:
about 1 month ago
Edit Post #285135 Initial revision about 1 month ago
Question Why does fopen return NULL?
```c #include #include int main (void){ FILE cfPtr; char name[15]; int ID; if ((cfPtr = fopen("students.txt","w")) == NULL){ printf("File could not be opened...\n"); //program gives me this as an output } else { //I want the output to be those in this else stateme...
(more)
about 1 month ago
Edit Post #285118 Initial revision about 1 month ago
Question What does the greater than 0 indicate in the case of this statement 'if (compare(A[j], A[j+1]) > 0)' ? Thank you.
Question: There is a list of integers in an array (3,2,1,5,6,4), sort this list in both ASCENDING & DESCENDING order. Create a sort function. ```c #include #include void BubbleSort (int A[], int n, int (compare)(int, int)){ int i,j,temp; for (i=0; i 0){ //regarding this line o...
(more)
about 1 month ago
Comment Post #285100 Okay, apologies for any inconvenience caused.
(more)
about 1 month ago
Edit Post #285104 Post edited:
about 1 month ago
Edit Post #285104 Initial revision about 1 month ago
Question What does a variable followed by parentheses ("ptr()") mean?
What does `ptr()` mean in this code? ```c #include #include void PrintHello() { printf("Hello\n"); } int Add(int a, int b) { return a+b; } int main () { void (ptr)(); ptr = PrintHello; ptr(); //For this specific line of code, what does it mean? } ```
(more)
about 1 month ago
Edit Post #285100 Post edited:
about 2 months ago
Edit Post #285100 Post edited:
about 2 months ago
Edit Post #285100 Initial revision about 2 months ago
Question Invalid memory access when trying to dereference a pointer obtained through a function call
Hey, regarding a question on returning pointers as functions, why does my code produce this error & won't print out the sum = 6? Code error Pop-up error message ```c #include #include int Add(int a, int b){ int c = (a) + (b); return &c; } int main (){ int x=2, y=4;...
(more)
about 2 months ago