Memory contents are very poor sources of randomness. In particular, most OSs will zero memory before providing it to a process, which makes the memory non-random in the first place. Second, it is a...
Type: Posts; User: mitakeet
Memory contents are very poor sources of randomness. In particular, most OSs will zero memory before providing it to a process, which makes the memory non-random in the first place. Second, it is a...
The problem with fgets() (and why I didn't use it) is that if you have lines longer than your buffer you get truncation with the next read being the remainder of the buffer (presuming it is still...
This will do what you want, though it is quite sensitive to the format of your input file (it basically requires that there be a linefeed immediately after the last number):
#include <stdio.h>...
All wrong. RTFM scanf before you go much further!
Try this (compiled, but not tested):
#include <stdio.h>
#include <stdlib.h>
int main() {
It is nice to know that you are a mature adult who is capable of carrying on a meaningful debate and not a childish twit who can only be rude and obstructive NOT.
Instead of a useful comment...
When was the last time you read the FAQ you quote so often? Please show me where it specifically address the problem with my code.
I agree with your statement and the information in the FAQ, what I don't agree with is Quzah telling me I am wrong for using feof() and failing to back that statement up. If he is so sure I am...
While you certainly have an argument for a logical flaw in counting the number of lines, I still fail to see how my code is incorrect if you were to look at it in isolation. If you simply want to...
Do the FTP script thing, it is quite painless. The use of a file for 'locking' does have problems (research 'race conditions' if you are bored), but they are typically on the milisecond or less...
Why not post some real code?
fgetc() returns an INT and EOF is an INT which means that when truncating it to a char you will never see EOF.
Say you do your file processing at 10 AM and it is expected to last 30 minutes. Then you do your upload at 10 PM and it is expected to take 5 minutes. Should never be any chance of overlap, right? ...
It is six of one, half dozen of another. If you want absolute control of the timing, embed it in your program. If you can be positive that the time scheduled for the file transfer will never...
So show me what is wrong, oh guru of gurus! Show me how smart you are! Your FAQ tells me nothing about why my code is wrong.
I have in fact read your FAQ and I see nothing that changes my mind. Care to point out where I am so wrong, you being so smart and all?
You don't have to define the methods as inline, you just have to put the methods in the header file (it is 'bad form' to include the cpp file). The vast majority of compilers will only look in...
Care to explain to a dense 10 year professional programmer how my code is wrong? Your FAQ doesn't tell me how my code is flawed.
There are libraries you can link to that will give you FTP capability. Keep in mind that the FTP protocol exchanges username and password in the clear (as is all the data being transmitted), so be...
How about (untested):
while (!feof(fin)){
if (fgetc(fin) == '\n') lineCount++;
}
You must have a break in the point b loop or it will run forever, it is that simple. How to break it is entirely up to you.
If something inside your loop blocks, you will need to use signals.
It is a matter of style, no more. I would use an array with enums as indexes, but that is my style.
Well, I intended to use CHAR_BIT, but forgot. size_t is better syntax (i.e., more portable) and again an oversite. I agree that with the cast the mask is entirely redundant, though how you write...
How about this (tested on Solaris (bigendian) and Intel (little endian)):
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
void printBits(unsigned char val){
size_t i, end...
Intel is little endian, so everything is 'backwards'.