How should I use fgets() ?
Type: Posts; User: dekl
How should I use fgets() ?
Hello, I would like to make a function, void read_line(File *f, char line[]), that does taht :
It will read a line of a file (already opened) replacing the last \n by the char of the end of a string...
true that it is more logical this way...
#include <stdio.h>
#include <string.h>
int main (int argc, char*argv[]){
int i,j;
int length;
char *argx;
true that it works like that but then what is strcpy for ?
here is the final working program!
#include <stdio.h>
#include <string.h>
int main (int argc, char*argv[]){
oh right, sorry for the spelling as you can tell it is not my native language...
how can I use only argv[i] ? wont it make a two dimention table if I say argv[i][length] ?
thanks again for the...
Well I did that, and I am sure it is not what you expected me to do knowing that it doesn't work...
#include <stdio.h>
#include <string.h>
int main (int argc, char*argv[]){
int i;
...
Well maybe it will be easier to understand I I type the actual instructions...
We want to make a program called pointc2pointo that for any string taken as an argument, if it terminats by ".c",...
Hello,
I am creating a program named pointc2pointo wich will take a list of arguments and find the ones that terminates by .c and replace it by .o
so far I have that :
#include <stdio.h>
...
Thank you!
I don't really know what you mean by line by line but maybe you can look every char unetil you find \n .
It finaly works!
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
int i = 0;
if (argc > 1) {
printf("there are %d elements \n", argc);
...
So some of you might think it is funny or useless, but I am trying to practice and you can tell I need to...
so I want // to work as an enter, when the program sees // it prints \n, but I don't know...
je comprend...
du coup il suffit juste de rajouter des espaces dans tout ça et peut-être une code pour le retour à la ligne.
merci de votre aide :)
Well sorry for that I sometimes get confused...
argc is the number of arguments isn't it ?
argc is the number of argument isn't it ?
#include <stdio.h>
int main(int argc, char *argv[]) {
int i = 0;
if (argc > 1) {
printf("there are %d elements", argc);
printf("the first element is %s", argv[1]);...
So I changed it to that :
#include <stdio.h>
int main (int argc, char*argv[]) {
int i=0;
if (argc > 1) {
printf ("there are %d elements",argc);
printf ("the first...
oh I think I know
sorry I modified my post.
Well so I tryed to modify my program so that I create a file with all of the arguments and not only the first one, and once again it doesn't work. can you help me again pease ? :D
#include...
%s , s if for string right ?
Thank you, this tutorial will still be usefull. (stahta01)
oh right I am stupid... thanks a lot :D
Hello,
I would like to know where is my mistake on that program I made :
#include <stdio.h>
int main (int argc, char*argv[]) {
if (argc > 1) {
Oh ok I get it... I thought NULL would be error message, but I have to do it myself...