i have just started learning assembly and c could anybody please :( tell some good books on them especially C i am having problem in c i am new here does any body know good thread on AO about C
Printable View
i have just started learning assembly and c could anybody please :( tell some good books on them especially C i am having problem in c i am new here does any body know good thread on AO about C
Hi
"let us C by yeshvant kanetker" is the best book for newbs starting C
and "IBM PC Assembly Language and Programming by Peter Abel" for assembly
hi wolverine
i know a bit of C , i am not a absolute newb in C. i want a good book that explains Disk I/O in C :)
I think the Book " let us C" is good for both students and advanced programmer alike i always refer to the for C
could u help me out here i have this school assignment coming could u please explain Disk I/O a bit give example code or something
I'd advise purchasing/borrowing "The C Programming Language" (Kernighan and Ritchie) otherwise known as the K&R book. It covers I/O for files as well as low-level access in Unix and is *the* C reference book.
this program will read a file and count how many characters, spaces and newlines are present in a file
[quote]
#include "stdio.h"
void main()
{
FILE *fp;
char ch;
int nol=0, not=0,nos=0,noc=0;
fp=fopen("Test","r");
while(1)
{
ch=fgetc(fp);
if(ch==EOF)
break;
noc++;
if(ch=="")
nob++;
if(ch='\n')
nol++;
if(ch=='\t')
not++;
}
fclose(fp);
printf("\nNumber of characters=%d",noc);
printf("\nNumber of blanks=%d",noc);
printf("\nNumber of tabs=%d",noc);
printf("\nNumber of lines=%d",noc);
}[\quote]
haven't compiled but it should work let me know if it dosen't or u don't understand anything
what is this FILEQuote:
before a file could be read or written it must be opened. opening a file establishes a link between the program and the operationg system. the link between our prog and the OS is a structure called FILE which has been defined in the header "stdio.h". we request the OS to open a file and what we get back is a pointer to the structure FILE. that is why we make the following dec.Quote:
FILE *fp;
i can understand the rest of the code except
fp is the file pointer what does fopen() doQuote:
fp=fopen("Test","r");