J
John
Hello,
I'm trying to write a program that takes a string from a file and prints
each letter on its own line adding a blank line between word.
My code so far:
/*Get each line from file*/
while ((fgets(buffer,MAX_LENGTH,input_file))!=NULL)
{
/*Loop through each character until end of line is reached*/
for(i=0; buffer=='\0'; i++)
{
/*If letter isn't a space then print it*/
if (buffer!=' ')
{
printf("%s", buffer);
}
printf("\n");
}
}
For some reason it won't until the for loop.
I've debugged it and buffer contains the first line of the file (starts
Hello) so don't understand where I'm going wrong.
Cheers.
I'm trying to write a program that takes a string from a file and prints
each letter on its own line adding a blank line between word.
My code so far:
/*Get each line from file*/
while ((fgets(buffer,MAX_LENGTH,input_file))!=NULL)
{
/*Loop through each character until end of line is reached*/
for(i=0; buffer=='\0'; i++)
{
/*If letter isn't a space then print it*/
if (buffer!=' ')
{
printf("%s", buffer);
}
printf("\n");
}
}
For some reason it won't until the for loop.
I've debugged it and buffer contains the first line of the file (starts
Hello) so don't understand where I'm going wrong.
Cheers.