c - I need a library name -
i new @ ubuntu , i'm studying files learn in c programming. wrote codes, can't run them cause of wants me library. so, library contains files? using #include <stdio.h> in ubuntu it's bit different.
#include <stdio.h> #include <stdlib.h> int main() { file *ptrfile; if(ptrfile = fopen("test.txt","w")==null) { printf("the file couldn't opened\n"); } else { int i; for(i=1; i<=20; i++) { fprintf(fptrfile,"%d\n", i*5); } fclose(ptrfile); return 0; }
the file data opaque struct defined thru <stdio.h> , implementation in c standard library (it implicitly linked gcc - or clang - on ubuntu).
so compile source file aprog.c running in terminal
gcc -wall -g aprog.c -o abinary then run ./abinary in same terminal
note -wall asks gcc compiler warnings (add -wextra more) , -g asks debug information (to able use gdb debugger, or valgrind, later).
don't forget install build-essential , libc6-dev ubuntu packages
Comments
Post a Comment