Search:

Type: Posts; User: johnjrgs

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    2,000

    How to use fwrite to copy a file to a file

    this is what i've been thinking..



    char buffer[256];
    FILE *fp;
    FILE *fw;

    fp = fopen("read.txt", "r");
    fw = fopen("write.txt", "w");
  2. How do I do "write only 1 * strlen(input[i])...

    How do I do "write only 1 * strlen(input[i]) bytes because a char is only 1 byte." this part? Shall I use malloc/calloc? ;o help? xD thanks though.
  3. really? how do I fix it then? I tried. ...

    really? how do I fix it then?

    I tried.

    fwrite(*input[i], sizeof(input[i]), strlen(input[i]), fp);

    Does no good though. input[i] works but *input[i] doesn't D;
  4. Some weird characters popping up in fwrite function.

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    int main()
    {
    //write input into a file
    FILE *fp;
    int size = 0, counter = 0;
    char *data = calloc(size,...
  5. I see. thanks a lot! :D

    I see. thanks a lot! :D
  6. Help explain what this code does? Step by step please.. :D thanks! (About pointers)

    #include<stdio.h>
    #include<stdlib.h>
    #include<string.h>

    int main()
    {
    int size = 0, counter = 0;
    char *data = calloc(size, sizeof(char));
    int length = 1, counter1 = 0;
    char...
  7. How to read the data in a file and print it and then copy the contents to a file?

    #include <stdio.h>
    #include <stdlib.h>

    int main (int argc, char *argv[])
    {
    char buffer[256];
    FILE * myfile;
    myfile = fopen("read.txt","r");
    while (feof(myfile)==0)
    {
  8. int main() { char array[100]; char...

    int main()
    {
    char array[100];
    char *ptr;
    ptr = &array[0];
    int i, j;
    fgets(ptr, 100, stdin);
    printf("%s", array);
    getch();
    return 0;
  9. How do I use getchar and pointers at the same...

    How do I use getchar and pointers at the same time?
  10. I still am not sure what to do here though.. any...

    I still am not sure what to do here though.. any ideas?

    Thanks adak, I declared a ptr to the array I'm using atm. Not sure what to do after that though.

    May I ask where is the data after the...
  11. How to print everything you type till you hit enter using POINTERS.

    I think I need to use


    while(input[0]!='\n'){
    scanf("%s", input)
    printf("%s", pointerhere);
    }

    basically we were asked to make a program that will print everything before the user hits...
  12. Replies
    3
    Views
    858

    How can I fix this? D:

    How can I fix this? D:
  13. Replies
    3
    Views
    858

    What wrong with my copy strings program?

    This code is actually an excerpt from my addressbook program..
    address_count monitors the number of contacts added.
    Current_record monitors the input's position in the array.

    Anyway, here it is....
  14. How to check if a string has at least one character.

    For example: If you want to check whether a string has a '@' in it. If not, then ask the user to input another string.
  15. I see. I tried using that. The problem still...

    I see. I tried using that. The problem still persists.

    When I input "smith 23" the program accepts it. when it shouldn't. D:
  16. I see. For the for() loop what I should actually...

    I see. For the for() loop what I should actually check the characters in the string.. so it needs to check all the characters before exiting the while loop. I need the do while loop so because the...
  17. Here's my code but I think it doesn't check all...

    Here's my code but I think it doesn't check all the characters inside the string. It only checks the first element of the string and if it finds it wrong, then everything wrong. And if it finds it...
  18. That went fast. Thanks andreas!!

    That went fast. Thanks andreas!!
  19. How to check if a string is alpha numeric. D:

    help please? my program only checks the first character of the string.. D:
  20. How do I remove multi character constant warning?

    Here's the line of code with the warning


    if((addressbook[3][num][4]=='-')&&(strlen(addressbook[3][num])=='10'))

    Or what might be the possible causes of such a warning?
  21. Great explanation Dariyoosh. Thanks! Now all...

    Great explanation Dariyoosh. Thanks! Now all that's left is the edit function.

    BTW, I found something wrong with the add_contact function. In the 4th part of the input where the user is asked to...
  22. Doesn't work. D: could you please post an example...

    Doesn't work. D: could you please post an example pls?
  23. Problem with my address book program. (Delete function)

    Okay, I got 3 problems remaining(listing, editing and deleting) but I'll focus on the deleting function first. Okay, so here's my code:



    #include <stdio.h>
    #include <string.h>
    #include...
  24. Need help with this function. ThDoes not enter the for statement

    This is just an excerpt of my code for an addressbook program. The problem comes with the input of surname cause it accepts even numbers which it isn't supposed to do so. I checked the code and I...
  25. Thanks for the help Tim S! Code's working now!...

    Thanks for the help Tim S! Code's working now! I'll just try to fix the remaining errors in the code. Hehe, really a big help :)

    I also want to ask though what parameters are needed to check a...
Results 1 to 25 of 33
Page 1 of 2 1 2