this is what i've been thinking..
char buffer[256];
FILE *fp;
FILE *fw;
fp = fopen("read.txt", "r");
fw = fopen("write.txt", "w");
Type: Posts; User: johnjrgs
this is what i've been thinking..
char buffer[256];
FILE *fp;
FILE *fw;
fp = fopen("read.txt", "r");
fw = fopen("write.txt", "w");
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.
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;
#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,...
I see. thanks a lot! :D
#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...
#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)
{
int main()
{
char array[100];
char *ptr;
ptr = &array[0];
int i, j;
fgets(ptr, 100, stdin);
printf("%s", array);
getch();
return 0;
How do I use getchar and pointers at the same time?
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...
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...
How can I fix this? D:
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....
For example: If you want to check whether a string has a '@' in it. If not, then ask the user to input another string.
I see. I tried using that. The problem still persists.
When I input "smith 23" the program accepts it. when it shouldn't. D:
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...
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...
That went fast. Thanks andreas!!
help please? my program only checks the first character of the string.. D:
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?
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...
Doesn't work. D: could you please post an example pls?
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...
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...
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...