From: <sha...@si...> - 2007-06-29 15:39:10
|
Hi. textdat=fgetc(fp); You can also use standard function fscanf, write and read in stdio.h. Do not forgot to check the return value of every C lib function. For exemple, fopen can return NULL. See Demetris Zavorotnichenko a écrit : > > Hi guys. > > This Is really stupid but I am trying to read and write from files. > > So I want for example write to a file test.test a character “H” > > And then read that file and save the character in a variable. > > So I got this far : > > FILE *fp; > > char textdat; > > /* Write “GO” to a file */ > > fp = fopen("test.test", "w"); > > fprintf(fp, "Go"); > > fclose(fp); > > /* Read character from file */ > > fp = fopen("test.test", "r"); > > What next ? > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ------------------------------------------------------------------------ > > _______________________________________________ > gumstix-users mailing list > gum...@li... > https://lists.sourceforge.net/lists/listinfo/gumstix-users > -- Samuel Hangouët, Ingénieur R&D SILICOM Région Ouest 4 rue de Jouanet - 35700 Rennes Atalante Tél : 02.99.84.17.17 - Fax : 02.99.38.69.43 |