09-11-2002
why complicate the simple stuff...?
why don't u use :
scanf("%s",&x );
where x is declared as pointer to char (char* x)
I assume that the command is in string format, if it is a int, it will look like:
scanf("%d",&x);
where x is a int
good luck!
by wolk!
6 More Discussions You Might Find Interesting
1. Programming
Hello Friends,
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... (1 Reply)
Discussion started by: user_prady
1 Replies
2. Programming
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)
Discussion started by: f.ben.isaac
2 Replies
3. Programming
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)
Discussion started by: hurricane86
1 Replies
4. Programming
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)
Discussion started by: CRGreathouse
23 Replies
5. Programming
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)
Discussion started by: p1cm1n
4 Replies
6. Programming
Hi,
I have a string like this,
char str ="This, a sample string.\\nThis is the second line, \\n \\n, we will have one blank line";
if I want to use strtok() to seperate the string, which token should I use?
I tried "\n", "\\n", either not working.
peter (1 Reply)
Discussion started by: laopi
1 Replies
LEARN ABOUT OPENDARWIN
curs_scanw
curs_scanw(3X) curs_scanw(3X)
NAME
scanw, wscanw, mvscanw, mvwscanw, vwscanw, vw_scanw - convert formatted input from a curses window
SYNOPSIS
#include <curses.h>
int scanw(char *fmt [, arg] ...);
int wscanw(WINDOW *win, char *fmt [, arg] ...);
int mvscanw(int y, int x, char *fmt [, arg] ...);
int mvwscanw(WINDOW *win, int y, int x,
char *fmt [, arg] ...);
int vw_scanw(WINDOW *win, char *fmt, va_list varglist);
int vwscanw(WINDOW *win, char *fmt, va_list varglist);
DESCRIPTION
The scanw, wscanw and mvscanw routines are analogous to scanf [see scanf(3S)]. The effect of these routines is as though wgetstr were
called on the window, and the resulting line used as input for sscanf(3). Fields which do not map to a variable in the fmt field are lost.
The vwscanw routine is similar to vwprintw in that it performs a wscanw using a variable argument list. The third argument is a va_list, a
pointer to a list of arguments, as defined in <varargs.h>.
RETURN VALUE
vwscanw returns ERR on failure and an integer equal to the number of fields scanned on success.
Applications may use the return value from the scanw, wscanw, mvscanw and mvwscanw routines to determine the number of fields which were
mapped in the call.
PORTABILITY
The XSI Curses standard, Issue 4 describes these functions. The function vwscanw is marked TO BE WITHDRAWN, and is to be replaced by a
function vw_scanw using the <stdarg.h> interface.
SEE ALSO
curses(3X), curs_getstr(3X), curs_printw(3X), scanf(3S)
curs_scanw(3X)