I did a small research and it is just rewind(FILE *fp);...
but in my case the problem is that i have the mode r+ and reads+apends....does not reads+writes as it should!!
Type: Posts; User: nullifyed
I did a small research and it is just rewind(FILE *fp);...
but in my case the problem is that i have the mode r+ and reads+apends....does not reads+writes as it should!!
exactly. just type space tab enter many times and then crt&D....
xaxaxaa :) good!!! sorry...i am not good at english and my head is NOT Ok....
can you be more specific please?
exit(0); ->SUCCESS_EXIT
exit(1); ->FAILURE_EXIT
also there is another option brake; which does not exit a program but brakes a loop (just in case)!
if an exercise says: make a struct with some variables, what should i do?
1)
#include <stdio.h>
#include <stdlib.h>
struct Foo{
int x;
int y;
exactly!! thanks....
apart from the the "->" i have seen somewhere something like this that i wrote....is there another way to do it?
ok i' ll try to put "p".
insteed of the code you wrote can we use:
*(foo.x)=12;
*(foo.y)=13;
?
i would like to confirm that....i thought tha last four were correct.
after main() the command struct Foo foo; means that insteed struct Foo we can write foo?
i am not sure if this is what you are talking about, but there is a problem (red markers)...what is going wrong?
#include <stdio.h>
#include <stdlib.h>
struct Foo{
int x;
int y;
ok...thanks....
what about accessing the x and y variables?
which of the six ways are correct and which wrong?
Another question:
the reason that the variables does not change is because:
the whole box (made for the function) is deleted when going back in main. What i mean is that the variables CHANGE but...
thank you...what happens with 1)?
I have exams tomorrow morning, so i need a answer soon(if it is possible)...i know that we will have a program about structs and files. First, if anyone knows the most important points in structs...
yeah i know that i have to post code...and this is what i am doing...i just don' t know C very well so i have many troubles...and also, i don' t speek english daily (it is not my "first"...
"Create an empty file for writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file. "
this is what it says. But my file already exists...
thank you very much...i have one more question:
is there another way? i mean insteed "loc-buf" if there is another way that does the same "job".
you are correct....it needs a+, for read and apend.
Everytime it says "write" in the page, it means: delete everything in the file and add the things you type?
i guess no....i am not suprised cause if i am right every character (following the ascii code) is corresponding to a number...
ok. it is minus but i don' t understand. is ti like 3-2? loc is a pointer and buf is an array....So, is it correct saying pointer-array?
I' ll be glad if anyone could help...my problem is the following :
Question_1:
when i run the program i press 1 see some stats, then i press 2 so, i typed name, email and telephone.
after that i...
fgets? why? this is for files...
also "ch" is a int. getchar() give us a character...how can it be possible(ch = getchar())?
i mean it is like saying "int=g". it is not right...
ok...the real problem is this:
#include <stdio.h>
#include <string.h>
int main(void){
char *loc; // loc is a pointer.
char buf[81]; // buf is an array.
can someone write a simple program showing how strchr works(using only scanf(), printf() and not getchar(), gets())?