Should it keep getting 2 lines then echoing them back until i signal EOF?
This is the aim of the program.
Type: Posts; User: blob84
Should it keep getting 2 lines then echoing them back until i signal EOF?
This is the aim of the program.
Thank you for your reply and suggestions about the fnget function.
The reti_writen function can be replaced with the write function.
basic.h have the headers used for linux network programming.
I...
Hello i have a problem with this program, the client should send a string of two lines from standard input to the server and the server should receive the string of two lines and send back to the...
lol!
OK Salem thanks.
Ok I need to verify only if there are 2 digits, it doesn't matter what is the next character for this function, is it right?
int expectedDigit(char **s, int n)
{
int cd = 0;
int i = n;
...
This is fgets:
/* fgets: get at most n chars from iop */
char *fgets(char *s, int n, FILE *iop)
{
register int c;
register char *cs;
cs = s;
while (--n >...
1. 0
2. to the character after 6
do you think it is a waste of time scan all digits, so look at this code it should be better:
int expectedDigit(char **s, int n)
{
int cd = 0;
if...
Than it will return false.
Yes salem here the code:
int expectedDigit(char **s, int n)
{
int cd = 0;
if (isdigit(**s)) {
cd++;
while (isdigit(*++*s))
cd++;
Nice suggestion, but the first parameter of the expected*** function should be the address of the position of the next characters, for example we know that the first 2 characters are numbers so ...
Are you talking to validate date, for example day could not be 56 ?
Hello, If i want to verify the format of date dd/mm/year, I can easily use
sscanf, but i want to do it using a loop what to you suggest?
For example i can scan it using this code that skip space...
I'm wasting time with this book, it's very ugly, the code is ugly and the way it write it and there are a lot of errors.
Hello, i found this code on the sedgewick book:
#include <stdlib.h>
#include "Item.h"
static Item *q;
static int N, head, tail;
void QUEUEinit(int maxN)
{ q = malloc((maxN+1)*sizeof(Item));...
what are you saying is that the parent process doesn't exit?
Hi, I don't know why when i run this code with redirection of output,
a.out > file, it seems that the process child is not adopted by init.
#include <stdio.h>
#include <unistd.h>
#include...
ok it should be 2^10 processes, 1024
hi, it is only an exercise,
how many processes are there in 30 seconds?
I think 30x9 processes?
It is impossible to count trying the code.
#include <fcntl.h>
#include <stdio.h>
#include...
a full screen text editor without gui, it means it should work without desktop environment.
Hi, i have in mind to build a simpletext editor, not like vi for linux, but more like gedit, but command line not gui.
For who knows the subjetc, what are the main problems to solve?
It is an exercise that ask why this piece of code get this output.
I don't want to learn to write code like this.
So the asnwer is only that printf print to stdout and stdout is buffered.
Stop.
Yes anduril462, this is only a test, i will never use this code!
I tried new example like this code:
#include<stdio.h>
#include <fcntl.h>
#include <unistd.h>
int main() {
int c, fd;
fd =...
you should study discrete math.
#include<stdio.h>
#include <fcntl.h>
#include <unistd.h>
int main()
{ int fd;
fd = open("file", O_WRONLY);
close(1);
if (dup(fd) >= 0)
{
printf(" hello\n");
So fflush should be used after output stream;
if occures an error while writing output, calling fflush ensure that the data is printed to the output stream.