Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   retrieving strings with spaces from txt files (http://www.go4expert.com/forums/retrieving-strings-spaces-txt-files-t11902/)

troberts24r 7Jul2008 03:20

retrieving strings with spaces from txt files
 
I am using a txt file to store string values that contain spaces.

The code below is what I am using now:

if (!(spEncodeDecode = fopen("C:\\encodedecode.txt", "r")))
{
printf("\aCould not open input file.\n");
exit (100);
} // end if
int x = 0;
while (fscanf(spEncodeDecode, "%s", messageCode) != EOF)

{
A3 = messageCode;

}

the below string is the only string in encodedecode.txt

?Q.W,EMRNTBXYUV!ICO PZA;SDLFKGJH


After I read in a single string, the string that is in A3 is PZA;SDLFKGJH.

So I am a bit confused.

I am a student in C.

Thanks,

Tom

troberts24r 8Jul2008 01:05

Re: retrieving strings with spaces from txt files
 
So no one has a good answer on this question..

I know I could not have stumped everyone...

:mean:

shabbir 8Jul2008 09:22

Re: retrieving strings with spaces from txt files
 
Why don't you read the complete string and then split it.


All times are GMT +5.5. The time now is 06:09.