Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Activity for dumplingsā
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #285298 |
Post edited: |
— | over 2 years ago |
Edit | Post #285148 |
Post edited: |
— | over 2 years ago |
Edit | Post #285148 |
Post edited: |
— | over 2 years ago |
Edit | Post #285135 |
Post edited: |
— | over 2 years ago |
Edit | Post #285222 |
Post edited: |
— | over 2 years ago |
Edit | Post #285218 |
Post edited: |
— | over 2 years ago |
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) |
— | almost 3 years 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) |
— | almost 3 years ago |
Edit | Post #285298 |
Post edited: |
— | almost 3 years ago |
Comment | Post #285298 |
This is my question, I was the one who said "Hey I have a question" & "Thank you". (more) |
— | almost 3 years ago |
Comment | Post #285298 |
I just wanted the question to be displayed in a box.... (more) |
— | almost 3 years ago |
Edit | Post #285298 | Initial revision | — | almost 3 years 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) |
— | almost 3 years ago |
Edit | Post #285222 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285222 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285222 | Initial revision | — | almost 3 years 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 i... (more) |
— | almost 3 years ago |
Edit | Post #285218 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285218 | Initial revision | — | almost 3 years 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 do so in C in a time-efficient way, i.e. probably with the lowest number of comparisons ... (more) |
— | almost 3 years 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) |
— | almost 3 years ago |
Edit | Post #285204 | Initial revision | — | almost 3 years ago |
Question | — |
How to clear the contents of a file? How to clear the contents of a file using C? (more) |
— | almost 3 years ago |
Edit | Post #285148 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285148 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285148 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285148 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285148 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285148 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285148 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285148 | Initial revision | — | almost 3 years 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) |
— | almost 3 years 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) |
— | almost 3 years ago |
Edit | Post #285135 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285135 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285135 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285135 | Initial revision | — | almost 3 years ago |
Question | — |
Why does fopen return NULL? ```c #include #include int main (void){ FILE cfPtr; char name[15]; int ID; if ((cfPtr = fopen("draft.txt","w")) == NULL){ printf("File could not be opened...\n"); //program gives me this as an output } } ``` Output: > File could not be opened... (more) |
— | almost 3 years ago |
Edit | Post #285118 | Initial revision | — | almost 3 years 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) |
— | almost 3 years ago |
Comment | Post #285100 |
Okay, apologies for any inconvenience caused. (more) |
— | almost 3 years ago |
Edit | Post #285104 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285104 | Initial revision | — | almost 3 years 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) |
— | almost 3 years ago |
Edit | Post #285100 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285100 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285100 | Initial revision | — | almost 3 years 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) |
— | almost 3 years ago |