Thanks itsme86. I don't completely understand how 0 marks the end of line either.
I think it may be to do with reading the character using getc then converting it to an int using
atoi.
I'm going...
Type: Posts; User: a_satari
Thanks itsme86. I don't completely understand how 0 marks the end of line either.
I think it may be to do with reading the character using getc then converting it to an int using
atoi.
I'm going...
what I'm really trying to ask is, how do you determine end of line?
In my outputs, the end of line is represented as a 0.
I want to get rid of this. So far I've used if statements to check for the...
Hi. I'm reading integers from a file and placing them into an array.
How do you detect for end-of-line? I've tried checking using '\0' and '\n', neither works.
If I can detect the end-of-line then...
Hi. I'm trying to place the contents of a text file with integers into an array.
But the wrong values are being output to the screen:
FILE *fin;
char file_name_in[20]= "test.txt";
...
Thanks anduril462.
I think your right about spitting out the address of int_array.
I've changed my code to match what you've and Bayint have said:
while((getc(fin))!=EOF){
...
Thanks, Baynit and CommonTater.
Baynit: I tried your solution and got the same answer.
In the line:
int_array[i] = fgetc(fin);
fgetc gets the character and places it into int_array, which is...
Hi. Think I'm having trouble with fgetc.
I'm trying to read from a text file containing integers and write to an
integer array.
The text file contains: 9876 54321
the output from the array...
My first years C programming project was to create a Rot13 cipher program. The user would enter some text and the program changes it into the cipher. This might be a bit too easy for you.
I'm...
I checked the short cut under start>>programs>>Bloodshed Dev-C++>>Dev-C++ and it links to C:\Dev-Cpp\devcpp.exe. However Dev-Cpp does not exist under C. This is where I think I installed it and this...
Thanks for you advice tabstop.
I'll see if I can match those up tomorrow. Its very late now.
Re: code::blocks - I'll give that a try. Although it means learning a new environment.
hi,
I installed Dev-C++ on my laptop yesterday and was able to work with it. Today, when I try and open it, I get a 'missing shortcut' error. This has happened one before with Dev-C++ and I just...
you forgot to enter a \ in [\code].
thanks.
Brilliant hk_mp5kpdw, that worked.
I'm not sure what, 99[^\n] does though.
"%s", must only accept a string untill a space is pressed, so 99[^\n] must accept 99 charaters?
edit: %s is a...
Thanks Epy.
I haven't been able to find a good example of fgets and as far as I can see it only referes to reading data from files. Can you point me to a good example of fgets?
I'll keep...
Hi everyone,
I'm writing code that uses an encoding called rot13, where each letter is shifted 13 spaces, so "a" becomes "n" and "b" becomes "o" etc. It was an old C assignment.
The problem:
...