Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

put a file into an array and remove spaces

Status
Not open for further replies.

Bushbaby

Programmer
Apr 10, 2002
1
US
Suppose I write a couple paragraphs and save it as apple.txt. How do I put this file into an array and remove the blank spaces.
 
Well, I give it a shot.
But you have to test it yourself ok?

int main()
{
//assume all your text is in there at this stage char szParagraphs[65535]; //?

//this is the target buffer
char szFileText[65535];

int i=0, j=0, strl=strlen(szParagraphs);

while(i < strl){
if(szParagraphs!= ' ')
szFileText[j++] = szParagraphs;
i++;
}
return 0;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top