I need my sketch to print the name of the original INO file at the beginning of execution (during setup).

Is it possible? If so, what is the resource which should be used?

1 Answer 1


You can use the macro __FILE__ to get the filename that is being compiled. That may not be your INO file, but may be some derivative of it.


You also get some other handy macros:

The date the sketch was compiled

The time the sketch was compiled

The line number where __LINE__ is being used

The combination of __FILE__ and __LINE__ is commonly used for debugging:

Serial.prinln("Error 23 at line " __LINE__ " of " __FILE__);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.