![]() |
Infinite string
Hello all;
I want to take as an input a long string in C for my project. Could anyone suggest ways to go with it.Particularly if anyone can tell me whether taking the string using command line argument in main could help??????? Thanxx!!! |
Re: Infinite string
give us an example of a long string ,in order to understand what you want to do
generally you can use this Code:
int buffer=2000; |
Re: Infinite string
If you don't need to store the entire string then you can just read it from input a character at a time. A lot of utilities are based around this kind of loop:
Code:
while ((c=getchar())!=EOF) |
Re: Infinite string
Thanxx.......
I'll try out the suggestions................... |
Re: Infinite string
Hi virxen,
May be the following code will also help, but always make use that this structure is the last variable to be declared and the string is the last member of the structure, or else there is a danger of overwriting values of other memory locations Code:
#include<stdio.h> |
| All times are GMT +5.5. The time now is 21:01. |