[QUOTE=niek_e;852141]Alright, now run it again. I'll bet you 20 fictional bucks that it won't output that exact same thing again :) (well eventually it will once every gazillion times or so)[/QUOTE]

[QUOTE]
prabakar@prabakar-desktop:~$ ./a.out
FOURFOURFOURFOURFOURONETWOFOURONETWOFOURONETWOFOURFOURFOURFOURONETHREEFOURONE
THREEFOURONETWOONETWOONETHREEprabakar@prabakar-desktop:~$ ONETWOFOURONETWOONETWOONETWOFOURFOURONETWOONETHREEONETWOONETHREEONETWOONETWO
ONETWOONETWOFOURONETHREEONETWOONETWOONETHREE
prabakar@prabakar-desktop:~$ ./a.out
FOURFOURFOURFOURFOURONETWOFOURONETWOFOURONETWOFOURFOURFOURFOURONETHREEFOURONE
THREEFOURONETWOONETWOONETHREEprabakar@prabakar-desktop:~$ ONETWOFOURONETWOONETWOONETWOFOURFOURONETWOONETHREEONETWOONETHREEONETWOONETWO
ONETWOONETWOFOURONETHREEONETWOONETWOONETHREE
prabakar@prabakar-desktop:~$ ./a.out
FOURFOURFOURFOURFOURONETWOFOURONETWOFOURONETWOFOURFOURFOURFOURONETHREEFOURONE
THREEFOURONETWOONETWOONETHREEprabakar@prabakar-desktop:~$ ONETWOFOURONETWOONETWOONETWOFOURFOURONETWOONETHREEONETWOONETHREEONETWOONETWO
ONETWOONETWOFOURONETHREEONETWOONETWOONETHREE
[/QUOTE]
Now what was the bet? :D
To tell the truth I did not even care to read the program at first and I would admit that yes, indeed, I cannot assure that, it would be the answer every time.

Nick Evan commented: Here's 20 bucks :( +16

That's what I will do. But it is up to you.

[QUOTE=axyelp;799502]ummmm....
how can you giv print to a single variable var[i] with %s specifier???

your problem shouldn't be in the code but the definition of var[]![/QUOTE]

We don't know how it is declared, do we? It might be a 2D array or an array of Pointers or may be even vectors, the op should give more details if he/she wants a good answer

Salem commented: Yeah, that and many other possible horrors +28

Sorry to have suggested an untested code.
My little Google search found me [URL="

marcosjp commented: Very helpful, saved my day with a great solution +1

Thanks for your help. The project is completed:)
It works fine. I did get stuck when the client had to return a message to the server but google helped me get the answer:)

Salem commented: Congrats +21
Alex Edwards commented: That's right!! Google it! +4

1) the overloaded operator << return a reference to the fin object
2) type casting to primitive data type is as follows.

[code=cpp]class complex
{
int r, i ;
public :
operator int()
{
return rr-ii ; // some conversion to int
}
complex():r(0), i(0) { }
complex ( int a, int b ) { r = a; i = b ; }

};[/code]

if both the source & destination are user defined then the function for the cast may be either in source ot in destination.
Conversion routine in source is similar to that of the primitive types. But in destination is a little different.

[code=cpp]class dmy // source
{
int day, mth, yr ;
//methods
} ;
class date // destination
{
char a[10] ;
// conversion routine
public:
date ( dmy t ){/convert ints to char array/}
};[/code]

Hope this helps:)

I am confused looking at this thread. To convert a lower case letter to upper case I always subtracted 32 from the lowercase letter. Adding 48? Is this correct or is it a mistake.
Please reply.

Nick Evan commented: Thanks for the correction. You're right +6
jephthah commented: good catch +1

[code=c]

include <stdio.h>
include<string.h>

int main ()
{
char firstipadd[20], fname[30] = "D:\";
FILE *pFile;;
pFile = fopen ("D:\xyz.txt" , "r");
fseek(pFile,169,SEEK_SET);
fgets (firstipadd , 14 , pFile);
fclose (pFile);
strcat ( fname, firstipadd) ;
rename ( "D:\xyz.txt", fname ) ;
getchar ( ) ;
}
[/code]
This code is working for me for your txt file.
However, I dont like the idea of using fseek like this.
I would prefer reading the file char by char.
But since you are in a hurry, I'll give this for now.