Hello
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define DATA_FILE "data3.bin"
int main(int argc, char *argv[])
{{
FILE *fp;
char* buff;
if( ( fp=fopen(DATA_FILE, "wb") )== NULL)
{
printf("Klaida sukuriant faila %s\n",DATA_FILE);
exit(1);
}
printf("Iveskite teksta (Ivedimo pabaiga ctrl+z):\n");
scanf("%c", &buff);
while(!feof(stdin))
{
scanf("%c", &buff);
fwrite(&buff,sizeof(char),1,fp);
}
fclose(fp);
}
FILE *fp;
if ( ( fp=fopen(DATA_FILE, "rb+") )== NULL)
{
printf("Klaida atidarant faila %s\n",DATA_FILE);
exit (1);
}
char* buff;
buff = (char*) malloc (sizeof(char));
while ( fread(buff,sizeof(char),1,fp) == 1)
{
if (*buff >= 'a' && *buff <= 'z')
{
*buff-=32;
fseek(fp,-1,SEEK_CUR);
fwrite(buff,sizeof(char),1,fp);
fflush(fp);
}
}
fclose (fp);
return 0;
}
here is code is changing all small letters to big one, how to make that this code changes large letters to small ones, i tried to use strlwr function but it's don't work.
thank you for help
forgot to say that it's read all from bin file