I got stuck with fgets () & rewind() function .. Please need help..
Actually I am doing a like,
The function should read lines from a txt file until the function is called..
If the data from the txt file ends then it goes to the top and then again when the function is called it should display me the top row .. I am doing like below , But it's not doing what I am expecting
Please need help..
abc1.txt output
It should give me 12 rows as the function is called 12 times..
but it is returning me 9 rows..
How to solve it I am wondering from last couple of days ..Pls need help badly..
hey guys, im trying to learn bourne shell atm and I'm having some issues with functions.
so heres my code:
#!/bin/bash
##functions
memory () {
free -m
}
space () {
df -h
}
ip () { (5 Replies)
I'm working on my own pow function and I need to make a copy of *argv but
I think that I am having trouble with the size of *argv and the size of any array that I
make. The code below isn't working for me. and I want to accept any number no
matter the size with pow -f 2 2. I was working out... (16 Replies)
hello,
i'm trying to write a C-program that reads a file line by line.
(and searches each line for a given string)
This file is an special ASCII-database-file, with a lot of entries.
I checked the line with most length, and it was about 4000 characters.
With google i found several... (4 Replies)
I've been having trouble with reading past the end-of-file in C. Can anyone find my stupid mistake?
This is the minimal code needed to cause the error for me:
FILE *f = fopen(name, "r");
if (!f)
return;
pari_sp ltop = avma;
char line;
while(fgets(line, 1100, f) != NULL)
printf(".");... (23 Replies)
Hi all,
I have this method to read a string from a STDIN:
void readLine(char* inputBuffer){
fgets (inputBuffer, MAX_LINE, stdin);
fflush(stdin);
/* remove '\n' char from string */
if(strlen(inputBuffer) != 0)
inputBuffer = '\0';
}
All work fine but if i... (1 Reply)
Assume client send the message " Hello ", i get output such as
Sent mesg: hello
Bytes Sent to Client: 6
bytes_received = recv(clientSockD, data, MAX_DATA, 0);
if(bytes_received)
{
send(clientSockD, data, bytes_received, 0);
data = '\0';... (2 Replies)
SCO openserver 5r5
I only have this available to me ...
To list the files...
cpio -itcvB < /dev/nrct0
To copy a file out
cpio -icvdBum filename < /dev/nrct0So cpio is to archive or "zip" files up??
and /dev/nrct0 is the tape drive ???
How can i list all the files inside... (2 Replies)
Hi folks,
I'm trying to make a reconnection algorithm using rexec(), but I noticed that when rexec() fails returning -1, it is impossible to make it run successfully again until you restart the program or the thread.
Example, I have a endless loop for connection retries, if I supply a wrong... (7 Replies)