how to use execle and execvpe functions and how can i change the value of environment variables using envp[]
how to use execle and execvpe functions and how can i change the value of environment variables using envp[]
compression and decompression done (1 to 7 bit)
#include<stdio.h>
int main ()
{
printf(“Program to print a pattern of stars.\n”);
int i1,i2,i3,val;
printf(“Enter a number:\n”);
scanf(“%d”,&val);
for(i1=0;i1<val*2;i1=i1+2)
{
for(i3=val*2;i3>i1;i3=i3-2)
{
printf(” “);
}
for(i2=0;i2<=i1;i2++)
{
printf(“*”);
}
printf(“\n”);
}
return 0;
}
here is the code:
i was writing a character whose ASCII value is 144 to a file transfer.txt, then i close the file and open it to read the character which i wrote and when i checked the ascii value of it it was showing -112…..why????
#include<stdio.h>
#include<fcntl.h>
#include<stdlib.h>
void main()
{
char ch=144,str;
int fd;
fd=open(“transfer.txt”,O_WRONLY|O_CREAT|O_TRUNC);
if(fd<0)
{
perror(“fault\n”);
exit(1);
}
write(fd,&ch,1);
close(fd);
fd=open(“transfer.txt”,O_RDONLY);
read(fd,&str,1);
printf(“%d\n”,str);
close(fd);
}
today I have completed assignment no.1
I HAVE COMPLITE MY 1st ASSI .. AND 3QUESTION REMAING IN 2nd ASSI AND DISCUSS ON 3rd
x=y=1; z=x++-1;
z+=-x++ + ++y;
printf(“%d\n”,x); here x=3; but
printf(“%d\n”,z); here z=?? and how??
#include<stdio.h>
int main ()
{
printf(“Program to print a pattern of stars.\n”);
int i1,i2,i3,val;
printf(“Enter a number:\n”);
scanf(“%d”,&val);
for(i1=0;i1<val;i1++)
{
/*for(i3=val;i3>i1;i3–)
{
printf(” “);
}*/
for(i2=0;i2<=i1;i2++)
{
printf(“*”);
}
printf(“\n”);
}
return 0;
}
I tried to print a pattern of stars using for loop. The problem i am facing with the logic is that i want to print the following pattern:
*
***
*****
******* /*i.e is odd number of stars to be printed in n number of lines ; Where n is specified by the user;*/ I wanted to print this pattern using for loop only.
anyone wid solution?
Assignment1 is completed and assignment 2 remaining only 6 question
i have complete my 1st assignment and 8 question remaning in assignment 2
while compiling glibc- 2.12.1 i faced following error…
from <stdin>:1:
/root/chain/build/glibc/glibc-ports-2.12.1/sysdeps/arm/nptl/tls.h:48:3: error: #error “TLS support is required.”
/usr/bin/install -c -m 644 elf.h /opt/arm/sysroot/usr/include/elf.h
/usr/bin/install -c -m 644 ../bits/elfclass.h /opt/arm/sysroot/usr/include/bits/elfclass.h
/usr/bin/install -c -m 644 link.h /opt/arm/sysroot/usr/include/link.h
/usr/bin/install -c -m 644 /root/chain/build/glibc/glibc-ports-2.12.1/sysdeps/arm/bits/link.h /opt/arm/sysroot/usr/include/bits/link.h
make[2]: Leaving directory `/root/chain/source/glibc-2.12.1/elf’
make[1]: Target `install-headers’ not remade because of errors.
make[1]: Leaving directory `/root/chain/source/glibc-2.12.1′
make: *** [install-headers] Error 2
thnx
Dear E12 Trainees,
Update the status of shell script assignment and any issues regarding shell script has to be posted on this thread.